Skip to main content

An extremely fast mutation testing tool for Python

Project description

fest

An extremely fast mutation testing tool for Python.

PyPI License Rust Python


fest generates small changes (mutants) to your Python source code and checks whether your test suite catches them. Surviving mutants reveal gaps that line coverage alone cannot find.

Built in Rust with ruff's Python parser. ~25× faster than cosmic-ray on real-world projects (benchmark).

Highlights

  • 🔥 Parallel execution — runs mutants across all CPU cores simultaneously
  • 🎯 Coverage-guided — only runs tests that cover the mutated line, via per-test pytest-cov context
  • In-process plugin — a persistent pytest worker pool avoids per-mutant startup overhead
  • 🧬 17 mutation operators — arithmetic, comparison, boolean, return value, constants, decorators, loops, and more
  • 📊 Multiple output formats — text, JSON, and self-contained HTML reports
  • 🔄 Session support — stop and resume long runs with SQLite-backed sessions

Installation

From PyPI (recommended)

pip install fest-mutate

From source

git clone https://github.com/sakost/fest.git
cd fest
cargo build --release

The binary will be at target/release/fest. Make sure pytest and pytest-cov are installed in the Python environment you want to test:

pip install pytest pytest-cov

Quick start

cd your-python-project
fest run

fest will:

  1. Discover Python source files matching src/**/*.py (configurable)
  2. Run pytest with coverage to build a per-test line map
  3. Generate mutants from the discovered source
  4. Test each mutant against only the relevant tests
  5. Print a summary report
fest — mutation testing for Python

  Configuration loaded (fest.toml)  0ms
  Mutator registry built (14 mutators)  0ms
  Source files discovered (14 files)  0ms
  Mutants generated (4290 mutants)  23ms
  Coverage collected  40ms
  Session opened (.fest-session.db)  0ms
  Test workers ready (24 workers)  994ms
  Mutants tested (4186 mutants)  4m 6s

  Mutation Score: 85.7%  |  Killed: 2401  Survived: 314  Timeout: 80  Errors: 8

Configuration

Create fest.toml in your project root (or add [tool.fest] to pyproject.toml):

[fest]
source = ["src/**/*.py"]
exclude = ["**/test_*.py", "**/conftest.py"]
timeout = 30
workers = 8                    # default: 75% of CPU cores
fail_under = 80.0              # exit 1 if score is below this
output = "text"                # "text", "json", or "html"
backend = "plugin"             # "plugin" or "subprocess"
session = ".fest-session.db"   # enable stop/resume

All fields are optional — fest picks sensible defaults.

CLI

fest run [OPTIONS]
Flag Description
-s, --source <GLOB> Source file patterns
-e, --exclude <GLOB> Exclude patterns
-w, --workers <N> Parallel test workers
-t, --timeout <SEC> Per-test timeout (default: 10)
--fail-under <SCORE> Minimum mutation score (0–100)
-o, --output <FMT> text · json · html
-b, --backend <BE> plugin (default) · subprocess
--coverage-from <PATH> Use existing .coverage file
--session <PATH> SQLite session for stop/resume
--reset Reset session before running
--incremental Only re-test changed files
--seed <N> Deterministic mutation seed
--filter-operators <PAT> Include/exclude operators by name
--filter-paths <GLOB> Restrict mutation to matching files
--progress <STYLE> auto · fancy · plain · verbose · quiet
-v, --verbose Per-mutant progress output

Mutation operators

Operator Example
arithmetic_op x + yx - y
augmented_assign x += 1x -= 1
bitwise_op a & ba | b
boolean_op a and ba or b
break_continue breakcontinue
comparison_op a == ba != b
constant_replace TrueFalse, 01
exception_swallow raise Error()pass
negate_condition if x:if not x:
remove_decorator @cache(removed)
remove_super super().__init__()(removed)
return_value return valreturn None
statement_deletion do_something()pass
unary_op -xx, ~xx
variable_replace a = xa = y (same-scope same-type)
variable_insert a = f(x)a = f(y)
zero_iteration for x in items:for x in []:

Backends

Backend How it works Speed Compatibility
plugin (default) Patches modules in a long-lived pytest process ⚡ Fast Most projects
subprocess Overwrites source file on disk, runs pytest Slower Universal

The plugin backend falls back to subprocess automatically on infrastructure errors.

Performance

On python-ecdsa (17k lines, 1,477 tests):

fest cosmic-ray
Throughput 17.4 mut/s 0.7 mut/s
Time to complete 4 min ~6 hours (estimated)
Speedup ~25× baseline

See the full benchmark report for methodology and reproduction steps.

License

Dual-licensed under MIT or Apache-2.0, at your option.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

fest_mutate-0.1.1-py3-none-win_amd64.whl (2.9 MB view details)

Uploaded Python 3Windows x86-64

fest_mutate-0.1.1-py3-none-manylinux_2_39_x86_64.whl (3.1 MB view details)

Uploaded Python 3manylinux: glibc 2.39+ x86-64

fest_mutate-0.1.1-py3-none-manylinux_2_39_aarch64.whl (3.0 MB view details)

Uploaded Python 3manylinux: glibc 2.39+ ARM64

fest_mutate-0.1.1-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl (3.2 MB view details)

Uploaded Python 3manylinux: glibc 2.5+ x86-64

fest_mutate-0.1.1-py3-none-macosx_11_0_arm64.whl (2.9 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

fest_mutate-0.1.1-py3-none-macosx_10_12_x86_64.whl (3.0 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file fest_mutate-0.1.1-py3-none-win_amd64.whl.

File metadata

  • Download URL: fest_mutate-0.1.1-py3-none-win_amd64.whl
  • Upload date:
  • Size: 2.9 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fest_mutate-0.1.1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 f2c9a38db198c042785bacd225596222f374752117973a7e53dab770056d2a9b
MD5 a25fa692f4ab70f6d3706d2e89c7add2
BLAKE2b-256 901440286775698f6fa2782380053e1a7f9612d2068ea1315b7ac6e8670113a6

See more details on using hashes here.

Provenance

The following attestation bundles were made for fest_mutate-0.1.1-py3-none-win_amd64.whl:

Publisher: release-please.yml on sakost/fest

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fest_mutate-0.1.1-py3-none-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for fest_mutate-0.1.1-py3-none-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 2dcb6a8166fa040c086de4c9cb1f7dd276bf4a4be3dbc4718c199bb73dc847ec
MD5 427883d9ac88d293bde80eda87579a45
BLAKE2b-256 30b15eff10b67d364b2c38e9c38ec7696cb9f3f212caf9f3a9c8dc06a27de9a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for fest_mutate-0.1.1-py3-none-manylinux_2_39_x86_64.whl:

Publisher: release-please.yml on sakost/fest

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fest_mutate-0.1.1-py3-none-manylinux_2_39_aarch64.whl.

File metadata

File hashes

Hashes for fest_mutate-0.1.1-py3-none-manylinux_2_39_aarch64.whl
Algorithm Hash digest
SHA256 8a397b5b8e4b4acdd5b8c4cdb62f28de8bda7965d0fe9472a2d13e5b16db50ba
MD5 d30c4af9920389d7c0801a70e1995b45
BLAKE2b-256 6aaf6b3be84f3dc44ae8ac036b7449db83ac4f9019078d6d140e84826f9c13e4

See more details on using hashes here.

Provenance

The following attestation bundles were made for fest_mutate-0.1.1-py3-none-manylinux_2_39_aarch64.whl:

Publisher: release-please.yml on sakost/fest

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fest_mutate-0.1.1-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for fest_mutate-0.1.1-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 9f0108ee0dbf1f71b0e607d70925219e1d00f2e5076a7d5a26be1757522f3641
MD5 ccd543bce07aa44a27e84d7359417c67
BLAKE2b-256 cc53bbda4085b26173ac528475150cf7a832ac075b2c8e5f19d940eca8202688

See more details on using hashes here.

Provenance

The following attestation bundles were made for fest_mutate-0.1.1-py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.whl:

Publisher: release-please.yml on sakost/fest

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fest_mutate-0.1.1-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for fest_mutate-0.1.1-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 07151f448fb8c6ba9dee9b47520b7e6eda3fed9e5af31fdfbab4799d0afdb181
MD5 4fca0142782bc5b478275b7e5a2b9331
BLAKE2b-256 f8465fc545574236e1bf6d255606bfb725112180ec57fc6a0685f5216e51f86f

See more details on using hashes here.

Provenance

The following attestation bundles were made for fest_mutate-0.1.1-py3-none-macosx_11_0_arm64.whl:

Publisher: release-please.yml on sakost/fest

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fest_mutate-0.1.1-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for fest_mutate-0.1.1-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 2d832afcee0a24bcae3b88e0c607176681a2073643784f8174aae41b642aaff5
MD5 0497541d37b154a8834cb4d095edb890
BLAKE2b-256 2f25ca294232199f0b3aab7d3b4d036eb358b5ae975d53acb05ca3fcb634c703

See more details on using hashes here.

Provenance

The following attestation bundles were made for fest_mutate-0.1.1-py3-none-macosx_10_12_x86_64.whl:

Publisher: release-please.yml on sakost/fest

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page