- Home
- Mutation Testing Tools
- pymute
pymute
What it is
pymute is a free mutation testing tool for Python and pytest, written in Rust. It creates a temporary directory for each mutant and changes Python file text rather than working on the abstract syntax tree. Pytest is the default test runner, and tox is also supported. Documented mutation types cover mathematical operators, conjunctions, booleans, control flow, comparisons, and numbers. By default, pymute reports mutants that survive because tests pass; other output levels can show caught mutants or underlying process output. Options let users filter files with a module glob, choose tests and mutation types, set the number of threads, and cap the mutant count; the cap runs a randomly sampled subset. With pytest, tests should run from the project root in independent copies and test the local copy rather than an installed package. Tox creates a separate virtual environment and installs the package for each mutant, which the project says is considerably slower. Installation uses Cargo from crates.io or GitHub and requires Rust and Cargo. Parallel threads need temporary disk space, and a run may fail if /tmp runs out. The repository identifies its license as Unlicense.
For and against
For
- Supports pytest and tox test runners.
- Offers six documented categories of mutation.
- Can filter files, tests, and mutation types.
- Parallel execution and mutant-count limits are available.
- Free to install using Cargo.
Against
- Requires Rust and Cargo.
- Parallel threads need temporary disk space.
- Tox runs are considerably slower, according to the project.
- Pytest runs need independent project copies and local-copy testing.
The verdict
pymute provides configurable mutation testing for Python projects using pytest or tox. Before adopting it, account for the Rust and Cargo requirement, pytest’s project-layout constraint, and the extra time tox uses to set up environments.
Who it suits
pymute may suit Python developers who want to check whether pytest or tox tests catch code mutations. It requires Rust and Cargo and is intended for Linux.
Plans and prices
Free/open-source
Install with Cargo; requires Rust and Cargo
Read 8 Oct 2026 · github.com
On the record
- Configuration
- Users can restrict mutations by module glob, select tests, choose mutation types, set thread count, and cap the number of mutants.github.com · read 7 Oct 2026
- Distribution
- The README says to install pymute using Cargo from crates.io or directly from GitHub, and requires Rust and Cargo.github.com · read 8 Oct 2026
- How it works
- It creates a temporary directory for each mutant and inserts mutations by manipulating text in Python files rather than operating on the AST.github.com · read 7 Oct 2026
- Installation
- The README says to install pymute with Cargo from crates.io or directly from GitHub, and requires Rust and Cargo.github.com · read 7 Oct 2026
- License
- The repository identifies its license as Unlicense.github.com · read 8 Oct 2026
- Maker
- The Cargo manifest names Leonard Sasse as the author.github.com · read 8 Oct 2026
- Mutation approach
- It creates a temporary directory for each mutant and inserts mutations by editing Python file text rather than operating on the AST.github.com · read 8 Oct 2026
- Mutation types
- Its listed mutation types include math operators, conjunctions, booleans, control flow, comparison operators, and numbers.github.com · read 8 Oct 2026
- Output
- By default, it displays mutants that tests missed, with optional caught and process output levels.github.com · read 8 Oct 2026
- Parallelism
- The --num-threads option controls how many mutants run in parallel, and each thread uses temporary disk space.github.com · read 8 Oct 2026
- Project layout constraint
- With pytest, the project’s tests need to run from the project root in independent copies and test the local copy rather than an installed package.github.com · read 7 Oct 2026
- Purpose
- Pymute is a mutation testing tool for Python and Pytest written in Rust.github.com · read 8 Oct 2026
- Pytest requirement
- With pytest, tests should run from the project root in independent project copies and test the local copy rather than an installed package.github.com · read 8 Oct 2026
- Resource use
- The README notes that each parallel thread needs temporary disk space and may fail if /tmp runs out of space.github.com · read 7 Oct 2026
- Sampling
- The --max-mutants option runs a randomly sampled subset of mutants.github.com · read 8 Oct 2026
- Scoping
- The --modules option filters files using a glob, and files named test_* or ending in *_test.py are automatically excluded.github.com · read 8 Oct 2026
- Test runners
- It supports pytest as the default runner and tox as an alternative.github.com · read 8 Oct 2026
- Test selection
- The --tests option runs selected tests, which the README recommends for quicker iteration on specific modules.github.com · read 8 Oct 2026