mutmut icon indicating copy to clipboard operation
mutmut copied to clipboard

Support mutating changed lines only

Open NouemanKHAL opened this issue 1 year ago • 7 comments

It would be more convenient to run something like mutmut run --diff-only without having to manually generate the patch file and use the --use-patch flag.

Some kind of wrapper on top of the --use-patch implementation.

Related to https://github.com/boxed/mutmut/issues/43

NouemanKHAL avatar Apr 09 '24 15:04 NouemanKHAL

Mutmut already does this if you have run a complete mutmut round first.

boxed avatar Apr 09 '24 15:04 boxed

Is that necessary? It's definitely not practical / feasible for large projects...

NouemanKHAL avatar Apr 09 '24 15:04 NouemanKHAL

I guess you could argue for a command that fills the entire mutmut cache with "skipped" for all mutants. Then after that you would get the change mode automatically.

boxed avatar Apr 09 '24 15:04 boxed

I like the idea! However, does that require generating all the mutants? I assume there would be some kind of hashing mechanism to keep track of each mutant.

NouemanKHAL avatar Apr 09 '24 15:04 NouemanKHAL

Well.. yea all the mutants are "generated" on startup in memory. Then they get IDs based on the cache db.

boxed avatar Apr 09 '24 16:04 boxed

Would be done in reasonable time in large projects?

NouemanKHAL avatar Apr 10 '24 09:04 NouemanKHAL

I don't know what you mean by reasonable or large :) But you can try it. If you do mutmut run and suppy --test-time-base it won't run the initial test run. So as soon as you get the number of mutants starting to count up from zero it will have done this work.

boxed avatar Apr 10 '24 10:04 boxed

I just released mutmut 3, which is a big rewrite. It has code to run only relevant tests, and you can point it nicely to run just mutants in certain module or functions. See the new docs.

boxed avatar Oct 20 '24 14:10 boxed