rut: A Python Test Runner That Skips Unaffected Tests
Source: Dev.to
Why another test runner?
pytest-incremental requires pytest. Its plugins are great individually, but combining multiple plugins into a consistent experience is hard — they step on each other, configuration gets fragile, and debugging interactions is painful.
Codebases have grown orders of magnitude, and AI‑assisted workflows are accelerating that further. We need new test infrastructure to keep up. Parallelization helps, but fast turnaround is still king — skipping what doesn’t need to run beats running it faster.
Getting started
pip install rut
# Run all tests and build the dependency graph
rut
# Run only tests affected by recent changes
rut --changed
How it works
rut analyzes your import graph. If api.py imports models.py which imports utils.py, and you change utils.py, rut knows to run tests for all three. Tests for modules that don’t depend on utils.py are skipped.
For well‑structured codebases, this typically means 50–80 % fewer tests on incremental runs.
Read more:
Features
- Dependency‑aware ordering – foundational tests run first, so failures point to root causes.
- Async support – built‑in, no plugins needed.
--dry-run– see what would run without actually executing the tests.- unittest compatible – drop‑in replacement for
python -m unittest.
Try it
pip install rut
rut