-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exit 1 with "FAILED" and no explanation after forced fail test #349
Comments
Forced fail is a quick check to see if the mutants are being run. It's quite easy to get into a situation where the original code is first in the import list and then all mutants will survive. Which might be what happens in your case. During forced fail, ideally only one test should be run and that should immediately fail. |
I just updated the commit hash in the steps to replicate, it was the wrong one. |
Hi @boxed. I've forked our repository and brought this little challenge on holiday with me for the bits where I just want to stay out of the midday sun ;-) If you were to run the following commands, the problem manifests fairly quickly...
To keep the blast radius small, I think I have configured it so that the only test file in play is tests/platform_helper/providers/test_ecs.py and the only file that mutmut is trying to mutate is dbt_platform_helper/providers/ecs.py. I am not sure what you mean by "It's quite easy to get into a situation where the original code is first in the import list and then all mutants will survive.". I'm hoping you can have a look and explain further? |
I meant when developing mutmut. I have many times broken mutmut in some subtle way and suddenly it executes the original code when it should be running the mutated code. Any config done by users could also have this effect as it's very sensitive to changes for python path. Writing mutmut 3.0 was quite a pain due to this brittleness. Mutmut 2 was much more robust in this way, but it was also extremely slow so I think it's worth it... |
I would like to get to the bottom of it. So that we can use Mutmut 3, which as you say is fast, and to help make it easier for others to start using it. |
Help is greatly appreciated. I have very limited time with family and working at a startup... |
Are there instructions anywhere for working on Mutmut, similar to a CONTRIBUTING.md. I would like to fork Mutmut then run my local copy of that against our offending code to see if that helps me figure it out. |
No there is no such documentation. |
How do you do it? Sketchy instructions are fine, I will tidy them up as a start to a contributing page. |
I read the code, and I know how it's supposed to work because I wrote it all :P The basic idea is using "mutant schemata", which is an industry term for generating all the mutants up front and renames the original function. Then it replaces the original functions with a "trampoline", which will call either the original function or a mutant depending on some command for which mutant should be active. In this case this is controlled by an environment variable. The execution model is based on There's also some code that detects which tests hit which functions, so only relevant tests are run, which can cut execution time with a lot. |
I've made a small pull request to get myself started. Next I will move onto creating an initial Then I will try and figure out how to make Mutmut work with the https://github.com/uktrade/platform-tools tests and hopefully make Mutmut handle it them as they are. If I can't do that, I will at least document what is needs to be changed in the codebase under test. |
Hello ! I seem to have this problem too. I can't get mutmut >= 3.0.0 to work. I made a mini repo with a single function and a single test here: https://github.com/Julien-Delavisse/mutmut-v3-tests you can do a I thought the problem might come from a particular version of python or mutmut, so I made a little script to test mutmut against its version and the version of python, all isolated in Docker. It turns out that mutmut doesn't work on this very simple repo with version >= 3.0.0, so the python version doesn't make any difference. You can run the I took a quick look at the mutmut source code, wait and see 😅 |
The common thread here seems to be to by |
@Julien-Delavisse Thanks for this reproduction. |
@Julien-Delavisse I looked into your project, but I'm afraid your reproduction isn't very useful. You do |
Hi @boxed ! Thanks already for your very useful project 😉 I modified my project to go in your direction, but it does not change my results that mutmut >= 3.0.0 does not work (but that mutmut < 3.0.0 works). What modifications have you made to make this example project work? |
Ah. I'm running from the main branch, not the latest released version. If you do that your simple project works, but I believe not the other projects in this issue. But please, anyone affected, do try with the latest code from |
I made a I'm curious about the different results between us. Do you have any ideas?
|
I am still experiencing the same issue with the code/branch where I'm trying to get Mutmut working with our codebase. |
I thought it might be because I have skipped a few tests for now because they don't play ball when running with mutmut, but I commented them out and the result was the same.
Should this line be...
It's not obvious to me what the purpose or expected behaviour of the forced failed run is and it doesn't seem to be mentioned in the documentation.
I don't think our code resets os.environ anywhere.
Steps to replicate
Expected behaviour
Mutations are tested
Actual behaviour
The text was updated successfully, but these errors were encountered: