Mutmut – Python Mutation Tester
a year ago
- #testing
- #mutation-testing
- #python
- Mutmut is a mutation testing system for Python, focusing on ease of use.
- Key features include applying mutants on disk easily, remembering work done, knowing which tests to execute, interactive UI, and parallel execution.
- Mutmut 2 is available for mutating code outside functions, with a different execution model.
- Requires fork support; on Windows, must run inside WSL.
- Install via pip and run with 'mutmut run'.
- Supports incremental work and remembers progress.
- Use 'mutmut browse' to view mutants and 'mutmut apply' to write mutants to disk.
- Configuration via setup.cfg or pyproject.toml, including paths to mutate and test directories.
- Supports Unix filename pattern matching for mutants.
- Can copy extra files needed for tests via 'also_copy' in setup.cfg.
- Configurable max stack depth to limit test relevance for functions.
- Exclude files from mutation or specific lines with 'do_not_mutate' or 'pragma: no mutate'.
- Mutations include subtle changes like altering integer literals, operators, and control statements.
- Workflow involves running mutmut, browsing mutants, writing tests to kill mutants, and rerunning tests.
- Data stored in 'mutants/' directory; delete to start fresh.
- Contribution guide available for those wishing to contribute.