Skip to content

Comments

Only mutate files if the source file has been modified#470

Merged
Otto-AA merged 1 commit intomainfrom
cache-mutants
Feb 15, 2026
Merged

Only mutate files if the source file has been modified#470
Otto-AA merged 1 commit intomainfrom
cache-mutants

Conversation

@Otto-AA
Copy link
Collaborator

@Otto-AA Otto-AA commented Feb 15, 2026

When running mutmut run a second time, it will now only mutate modified source files. It will run all mutants nonetheless, because a change in some source file A can influence if a mutant of source file B would survive.

This is done by comparing the modified times of the source file with the mutated file. If source_mstat < mutant_mstat, we know that the source file has not been modified after we saved the mutated file.

(traces-parser) oaie:~/coding/python/traces_parser$ rm -r mutants/
(traces-parser) oaie:~/coding/python/traces_parser$ mutmut run
⠹ Generating mutants
    done in 1244ms (40 files mutated, 0 ignored, 0 unmodified)
⠙ Running stats     
    done
⠦ Running clean tests
    done
⠸ Running forced fail test
    done
Running mutation testing
⠦ 1092/1092  🎉 797 🫥 165  ⏰ 0  🤔 0  🙁 130    00
41.34 mutations/second

(traces-parser) oaie:~/coding/python/traces_parser$ mutmut run
⠦ Generating mutants
    done in 86ms (0 files mutated, 0 ignored, 40 unmodified)
⠋ Listing all tests 
⠴ Running clean tests
    done
⠹ Running forced fail test
    done
Running mutation testing
⠴ 1092/1092  🎉 797 🫥 165  ⏰ 0  🤔 0  🙁 130    00
42.66 mutations/second

(traces-parser) oaie:~/coding/python/traces_parser$ touch traces_parser/datatypes/hexstring.py 
(traces-parser) oaie:~/coding/python/traces_parser$ mutmut run
⠦ Generating mutants
    done in 212ms (1 files mutated, 0 ignored, 39 unmodified)
⠋ Listing all tests 
⠴ Running clean tests
    done
⠹ Running forced fail test
    done
Running mutation testing
⠴ 1092/1092  🎉 797 🫥 165  ⏰ 0  🤔 0  🙁 130    00
41.84 mutations/second

@Otto-AA Otto-AA merged commit bf3a2e8 into main Feb 15, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant