Python package that uploads coverage.py results to coveralls.io to publish coverage stats online.
tarpas/pytest-testmon
A pytest plugin that re-runs only the tests affected by your recent code changes, with optional continuous watch mode.
- Stars
- 1,034
- Forks
- 87
- Open issues
- 38
- Last commit
- 5 days ago
What is it?
pytest-testmon is a pytest plugin that records which code each test depends on and uses that dependency database to pick only the tests affected by recent changes. The first run with --testmon builds the database in .testmondata; later runs execute just the affected tests, which shortens feedback loops on large suites.
The project addresses the difficulty of determining affected tests in a dynamic language like Python, where static import graphs are not enough. Its documentation describes how it tracks dependencies and how reliable the selection is. Combined with pytest-watch, it can act as a continuous test runner that reruns the right tests on every save.
The package is installed with pip and enabled with a single --testmon flag. The project also runs an opt-in program in which the maintainers set up testmon in open-source projects' CI.
Key features
- 01Records dependencies between tests and code in a local .testmondata database.
- 02Re-runs only the tests affected by recent file changes.
- 03Works as a pytest plugin enabled with the --testmon flag.
- 04Pairs with pytest-watch for continuous test running on save.
Use cases
- Speeding up local test runs in a large Python project with a slow pytest suite.
- Running a fast subset of tests during active development.
- Setting up continuous testing that reruns affected tests on each change.
Quick start
- 1
Install the plugin with pip
pip install pytest-testmon - 2
Build the dependency database (saved to .testmondata)
pytest --testmon - 3
Change some of your code (with test coverage)
- 4
Run only the tests affected by recent changes
pytest --testmon
Things to know
- Selection relies on dependency tracking, so reliability depends on how the code is structured.
In collections
Topics
FAQ
- What is pytest-testmon?
- A pytest plugin that re-runs only the tests affected by your recent code changes, with optional continuous watch mode. pytest-testmon is a pytest plugin that records which code each test depends on and uses that dependency database to pick only the tests affected by recent changes. The first run with --testmon builds the database in .testmondata; later runs execute just the affected tests, which shortens feedback loops on large suites.
- Is pytest-testmon free to use? What license does it have?
- pytest-testmon is open source under the MIT license. Check the license terms before using it in commercial products.
- Is pytest-testmon still maintained?
- Actively maintained. The last commit to pytest-testmon was on Nov 2, 2026.
- What can I use pytest-testmon for?
- Speeding up local test runs in a large Python project with a slow pytest suite. Running a fast subset of tests during active development. Setting up continuous testing that reruns affected tests on each change.
- How do I install pytest-testmon?
- Install the plugin with pip: pip install pytest-testmon Build the dependency database (saved to .testmondata): pytest --testmon Change some of your code (with test coverage) Run only the tests affected by recent changes: pytest --testmon
- Where can I get pytest-testmon?
- The source code and installation instructions are on GitHub: https://github.com/tarpas/pytest-testmon
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A Python library that records HTTP interactions made during tests and replays them later, so tests run offline and deterministically.
A pytest plugin that runs tests in parallel across multiple CPUs and adds a loop-on-failures mode.
A pytest plugin that lets test functions be coroutines, so you can await asyncio code directly inside tests.
A BDD framework that runs Gherkin feature files as pytest tests, with no separate test runner needed.
A pytest plugin that randomly shuffles test order and resets random seeds so failures caused by ordering or random data can be reproduced.