mutmut
mutmut copied to clipboard
Option to do mutations not in place
For safety concerns it could be a good idea to do mutations not in place (e.g. constructing a tempdir with a copy of the source code and temp venv and applying mutants in that cloned enviroment). Maybe some experimentation should be done looking into alternatives for applying mutants?
Having mutmut mutate my working project source code even with version control protections makes me uncomfortable at times.
Why not clone it to a tempdir then before? :) This also ensures you do not have (un)committed local modifications.
I agree 100%. I started on trying this but never finished. Don't remember why.
If we fix this it will enable parallel execution too which would be pretty great! (Especially with my as yet unfinished branch that avoids pytest startup time this would be massively faster).
I wonder if it is at all possible to do mutations similar to hot patching (i.e. similar to how mocking libraries override functionality). Doing as such would allow for the same virtual environment to be used and disk IO would be kept at a minimum no?
I have no idea if this would yield a real performance gains, or if it is realistically feasible. But, it could be interesting (and clean) to do all mutations within the python run-time/namespace.
I've looked a bit at this, but it's suuuuuuuper hairy. I don't think it's a good idea.
Looking again at import hooks and forced module reloading seems more worthwhile to me. The latter I already have in a branch and that works fine.
@boxed would the hooks and forced module reloading mean mutations aren't done in place and enable parallel execution?
I should have commented more here. No the reloading of modules absolutely does not work. It MIGHT work, but that's the same as saying it doesn't work because it can't be trusted. I have a super iffy proof of concept of mutant schemata plus fork workflow with hammett, which seems to work very well but it's a lot of work to get that to production ready.
thanks for more info @boxed ! makes sense to me. :+1: