pytest-testmon is a free, open source build & deployment project written in Python and released under MIT. It has 1,033 GitHub stars, 87 forks and 38 open issues, and was last pushed 4 days ago. On this registry it ranks #61 of 84 tracked projects in Build & Deployment, with 5 head-to-head comparisons available. It gained 15 stars over the last 30 tracked days.

What is pytest-testmon?

pytest-testmon is an MIT-licensed pytest plug-in, written in Python, that automatically selects and re-executes only the tests affected by recent code changes, so developers and CI pipelines run the right tests first instead of the whole suite.

What it is

pytest-testmon is a plug-in for pytest, the Python test runner. While tests execute, the plug-in collects dependency data and builds a database; on later runs it uses that data to pick only the tests touched by recent edits. It installs from PyPI as pytest-testmon and activates through the --testmon flag, storing its state in a file named .testmondata. The project lives in the pytest ecosystem, carries the topics build-tool, ci, python, test-automation and testing, and documents its options at testmon.org. The repository currently shows 1015 stars, 81 forks and 38 open issues, with the last push on 2025-12-01.

The concrete problem it solves is the full-suite re-run. On a large Python codebase, running every test after every edit costs time that the editor usually does not need, because most tests are unrelated to the change. pytest-testmon replaces that blanket re-run with an affected-test selection step, and the README acknowledges the obvious difficulty: selecting tests in a dynamic language like Python is not a trivial static-analysis exercise. The project answers that concern with a dedicated write-up, "Determining affected tests", linked from the README, and it states the reliability question openly rather than hiding it.

Key capabilities

  • Installs as a pytest plug-in with pip install pytest-testmon and runs through pytest --testmon.
  • Builds a dependency database and saves it to .testmondata on the first run, then reuses it on subsequent runs.
  • Re-executes only the tests affected by recent changes, rather than the entire suite.
  • Executes the right tests first, ordering the selected set by relevance.
  • Acts as a continuous test runner when paired with pytest-watch.
  • Supports additional options, documented at testmon.org, beyond the default --testmon invocation.
  • Offers a CI adoption programme: the maintainers run testmon inside a project, prepare the pull request, and set it up so that no tests are deselected initially.

Who uses it and how

  • Developers in a local edit-test loop: change code, run pytest --testmon, and get only the tests that the change affects.
  • CI pipelines, matching the repository's ci topic, where trimming a slow Python suite shortens feedback time.
  • Teams wanting continuous testing, running pytest under pytest-watch so affected tests re-execute as files change.
  • Open-source maintainers who join the CI programme, where the project is instrumented, data is collected, and deselection is introduced only when the reliability and time savings justify it.
  • Projects with large Python suites where running every test on every commit is the main bottleneck.

Getting started

Install the plug-in from PyPI with pip install pytest-testmon, then run pytest --testmon. The first run builds the dependency database in .testmondata, and later runs execute only the tests affected by recent changes.

How it compares

The facts provide no list of paid products that pytest-testmon replaces, and they name no similar test-selection tool. Within this registry it stands alone: it is the only entry here described as a pytest plug-in for affected-test selection.

When to use it — and when not

A self-hoster needs a working Python environment with pytest, plus a .testmondata file that is generated on first run and kept between runs; no external database, object storage or SMTP service is mentioned anywhere in the facts. It is not for non-Python suites, and it is not for teams running a non-pytest test runner, since the whole mechanism depends on pytest. Two honest caveats: the README is short and pushes most documentation to testmon.org, so users depend on that site, and the project itself frames selection accuracy in dynamic Python as still being collected and improved through its CI programme, which means the affected-test set should be treated as a heuristic rather than a guarantee.

project readme (upstream, from github) — read inline

This is a pytest plug-in which automatically selects and re-executes only tests affected by recent changes. How is this possible in dynamic language like Python and how reliable is it? Read here: Determining affected tests

Quickstart

pip install pytest-testmon

# build the dependency database and save it to .testmondata
pytest --testmon

# change some of your code (with test coverage)

# only run tests affected by recent changes
pytest --testmon

To learn more about different options you can use with testmon, please head to testmon.org

Call for opensource projects: try testmon in CI with no effort or risk.

We would like to run testmon within your project, collect data and improve! We'll prepare the PR for you and set everything up so that no tests are deselected initially. You can start using the full functionality whenever the reliability and time savings seem right! Please SIGN UP and we'll contact you shortly.

Frequently asked questions

Is pytest-testmon free to use?

pytest-testmon is open source under the MIT licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does pytest-testmon do?

Selects tests affected by changed files. Executes the right tests first. Continuous test runner when used with pytest-watch.

What is pytest-testmon written in?

pytest-testmon is primarily written in Python. Its source is publicly available at https://github.com/tarpas/pytest-testmon, and it has 1,033 GitHub stars.