PIT vs pytest-gremlins
PIT
pitest.orgpytest-gremlins
github.comSide by side
| Figure | PIT | pytest-gremlins |
|---|---|---|
| Price from | — | Free |
| Free plan | — | Yes |
| Free trial | — | — |
| Open source | — | — |
| Windows | Yes | — |
| macOS | Yes | — |
| Linux | Yes | Yes |
| Self-hosted | Yes | — |
| Plans published | 0 | 1 |
| Spec score · Mutation Testing Tools | 7.0 (#20) | 7.7 (#10) |
| Purpose | PIT runs unit tests against automatically modified versions of application code to measure whether tests detect faults. | pytest-gremlins is a pytest plugin that injects small code mutations and checks whether tests catch them. |
| Reports | PIT produces reports combining line coverage and mutation coverage information. | It supports console, HTML, and JSON reports, including multiple report formats in one run. |
Plans
In their own words
PIT
PIT is a free mutation-testing tool for Java and JVM bytecode projects. It measures whether unit tests detect faults by running them against modified versions of application code. Configurable bytecode mutations can remove method calls, invert logic, or change return values. PIT selects and prioritizes tests using line coverage, execution speed, and naming conventions, then reports mutation coverage alongside line coverage. It can run from the command line, Ant, or Maven; third-party integrations are listed for Gradle, Eclipse, and IntelliJ. Java is supported directly, and Kotlin use is available through the ArcMutate plugin. PIT supports JUnit 3, JUnit 4, and TestNG; JUnit 5 needs a plugin. Versions 1.4.0 and later require Java 8 or above and JUnit or TestNG on the classpath. Mutation runs can take a long time depending on codebase size and test-suite speed, so PIT recommends focusing on changed code. It mutates bytecode and requires line numbers and source file names in that bytecode.
pytest-gremlins
pytest-gremlins is a pytest plugin for checking whether an existing test suite catches small changes to code. It runs mutation tests against Python projects and can report results in the console, HTML, or JSON, including multiple formats in one run. Getting started requires Python 3.11 or later, pytest 7.0 or later, and existing tests; installation is documented with pip, uv, and Poetry. The project’s quick-start command is `pytest --gremlins`. To manage execution, it uses mutation switching, coverage-guided test selection, incremental analysis, and parallel execution, and it works with pytest-xdist. Options can be set in `pyproject.toml` or with command-line flags, while inline pragmas can pardon specific mutations. A GitHub Action can run the checks and fail a workflow if its score misses a threshold; CI examples also cover GitLab CI, CircleCI, and Dagger. It is a free, MIT-licensed package for Linux, classified as Alpha. The guide warns that an initial run may take 10–100 times as long as a normal test run, though caching can shorten later runs. It also notes that equivalent mutations can make a perfect score unattainable and unnecessary.