skillfed

pytest-cagoule

Pytest plugin to only run tests affected by changes

pytest-cagoule v0.4.0 127.0K downloads/30d#11,755 on PyPI7
Permissive license MIT Abandoned released

What it is and what it does

pytest-cagoule is a pytest plugin that uses coverage data to map which tests exercise which lines of code, then lets you run only the tests affected by your recent changes. After an initial full test run with coverage collection (using --cov --cov-context=test), you can specify a file path or use git diff to automatically identify changed code, and the plugin will select and run only the tests that touch those lines.

The plugin is designed for CI workflows where you want to speed up feedback by skipping unaffected tests. It has no runtime dependencies and integrates directly with pytest's command-line interface. However, it only captures coverage for code executed during test runs themselves, not module-level imports, so some code paths may be missed. The package is in alpha status and has been unmaintained since 2020.

Use it for:

  • Speed up CI pipelines by running only tests affected by a pull request's changes.
  • Identify which tests exercise a specific file you're debugging or refactoring.
  • Validate that a change to a utility module doesn't break tests in dependent modules.
  • Reduce local test cycle time during development by running only affected tests after code edits.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

A pytest plugin that identifies which tests exercise code you've recently changed, allowing you to run only the affected subset instead of the full test suite.

No, not recommended for new projects. The package is abandoned (last release 2020-01-01, no maintenance since), has high install friction, and offers no guarantees of compatibility with modern pytest or coverage.py versions. While the core idea is sound, the lack of maintenance and unclear dependency requirements make it a poor choice. Consider actively maintained alternatives for test selection based on code coverage.

Install

pytest-cagoule on PyPI

pip

pip install pytest-cagoule

uv

uv add pytest-cagoule

poetry

poetry add pytest-cagoule

Installing pytest-cagoule

Before you install

High install friction: the package is abandoned (last release 2020-01-01, no commits since), and no runtime dependencies are declared, suggesting it may require manual setup or external tools. Maintenance status is a significant concern for new projects.

License in practice

MIT license is permissive and imposes no restrictions on use, modification, or redistribution in your own projects.

Quickstart

pip install pytest-cagoule

# Collect coverage with test contexts
pytest --cov --cov-context=test

# Run tests touching a specific file
pytest --cagoule-select=path/to/file.py

# Or use git diff to find changed files
pytest --diff

Requires pytest and coverage.py to be installed separately; the plugin only captures lines executed during individual test runs, excluding module-level code executed at import time.

Verify before relying

  • Whether the plugin works with current pytest and coverage.py versions (last release was 2020-01-01).
  • Whether git integration (--diff flag) works reliably with modern git workflows.
  • Performance impact when handling large test suites or many changed files.

Package facts

License MIT (permissive)
Python support not specified
Install friction high — source build required
Runtime dependencies none
Maintenance abandoned — 2,417 days since the last release
Last repo commit
First released
Downloads 127,047/month — #11,755 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pytest-cagoule-0.4.0.tar.gz

Development Status :: 3 - AlphaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.7Topic :: Software Development :: Testing

Tags

pytest plugin affected testsrun only changed code testscoverage-based test selectiongit diff test filteringincremental test runner
test-selectioncoverage-driven

More Testing packages