pytest-testmon
pytest-testmon is a pytest plugin that automatically detects which tests are affected by code changes and runs only those tests, speeding up CI/CD pipelines. It uses dependency tracking to map code changes to test coverage and re-executes the minimal necessary test suite.
Key facts
Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.
| Field | Value |
|---|---|
| Repository | tarpas/pytest-testmon |
| Owner | tarpas |
| Primary language | Python |
| License | MIT — OSI-approved |
| Stars | 996 |
| Forks | 78 |
| Open issues | 37 |
| Latest release | v2.2.0 (2025-12-01) |
| Last updated | 2025-12-01 |
| Source | https://github.com/tarpas/pytest-testmon |
What pytest-testmon is
A pytest plugin that builds and maintains a dependency database (.testmondata) tracking coverage relationships between source code and tests. On subsequent runs, it compares file modifications against this database to select affected tests, reducing full test suite execution time in development and CI workflows.
Get the pytest-testmon source
Clone the repository and explore it locally.
git clone https://github.com/tarpas/pytest-testmon.gitcd pytest-testmon# follow the project's README for install & configurationNeed it deployed, integrated, or customized instead? DEV.co ships production installs.
Best use cases
Implementation considerations
- Initial setup requires a baseline run (pytest --testmon) to build the dependency database; subsequent runs leverage this data to filter tests.
- Dependency database (.testmondata) must be version-controlled or regenerated reliably in CI to avoid stale coverage maps across environments.
- Accuracy depends on test coverage; uncovered code changes will not trigger test selection, so coverage gaps create blind spots.
- Behavior with mocking, fixtures with side effects, and indirect dependencies may require tuning or manual exclusions; test the database against your codebase.
- Best paired with pytest-watch in development; CI integration requires careful setup to ensure the database is fresh and consistent across branches.
When to avoid it — and what to weigh
- Dynamic test discovery or highly coupled test suites — If tests depend on global state, fixtures with side effects, or tests are generated dynamically, the dependency database may miss affected tests or fail to track relationships accurately.
- Small test suites that execute in seconds — Overhead of maintaining the dependency database and initial collection may exceed the time saved; simpler projects benefit from running the full suite.
- Projects with minimal test coverage — If large portions of code are not covered by tests, testmon cannot correlate changes to tests and will skip many legitimate test selections, reducing its value.
- Strict requirement for guaranteed coverage of all changes — Testmon's reliability depends on accurate coverage tracking in a dynamic language; if there is no tolerance for missed affected tests, full suite execution is safer.
License & commercial use
MIT License (OSI-compliant permissive license). Grants rights to use, modify, and distribute freely with minimal restrictions.
MIT License explicitly permits commercial use. No licensing fees, restrictions, or proprietary terms. Suitable for internal and commercial product development without vendor lock-in.
DEV.co evaluation signals
Editorial assessment — not user reviews. Directional, with an explicit confidence level.
| Signal | Assessment |
|---|---|
| Maintenance | Active |
| Documentation | Adequate |
| License clarity | Clear |
| Deployment complexity | Low |
| DEV.co fit | Good |
| Assessment confidence | High |
No special security claims made. Dependency database is a local file; ensure .testmondata access is restricted if it contains sensitive coverage patterns. Uses standard pytest plugin architecture. Review upstream dependencies (pytest) for security advisories. No embedded credentials or remote telemetry evident.
Alternatives to consider
pytest-xdist
Parallelizes test execution across workers to reduce wall-clock time; does not filter tests by change, but complements testmon for full acceleration.
Bazel + aspect-bazel-lib (Python)
Build system-level change detection and test selection; more heavyweight but offers fine-grained dependency graphs across projects.
Custom git-based test selection (e.g., pre-commit hooks or CI scripts)
Parse git diffs and map files to tests via naming conventions or custom config; lightweight but requires manual maintenance and is less reliable for indirect dependencies.
Build on pytest-testmon with DEV.co software developers
Start with pytest-testmon for free. Install via pip, run pytest --testmon once to build your dependency database, then enjoy faster feedback loops. No vendor lock-in—MIT licensed, fully open-source.
Talk to DEV.coRelated open-source tools
Surfaced by semantic similarity across the DEV.co open-source index.
Related on DEV.co
Explore the category and the services that help you build with it.
pytest-testmon FAQ
How reliable is testmon's affected-test selection?
What happens if the .testmondata file is missing or corrupted?
Can testmon be used in CI without developers running it locally?
Does testmon work with parametrized tests and fixtures?
Software development & web development with DEV.co
DEV.co is a software development agency delivering custom software development services to companies building on open source. Our software developers and web developers design, integrate, and ship production systems — spanning web development, APIs, AI, data, and cloud. If pytest-testmon is part of your open-source testing roadmap, our team can implement, customize, migrate, and maintain it.
Ready to accelerate your Python test suite?
Start with pytest-testmon for free. Install via pip, run pytest --testmon once to build your dependency database, then enjoy faster feedback loops. No vendor lock-in—MIT licensed, fully open-source.