pytest-cache
pytest plugin with mechanisms for caching across test runs
What it is and what it does
pytest-cache is a pytest plugin that stores test execution state between runs, allowing developers to selectively rerun failed tests or prioritize failures in subsequent test sessions. It exposes a config.cache object that plugins and conftest code can use to persist arbitrary values across test invocations—useful for caching expensive computations or tracking test history.
However, this package is abandoned (last updated 2013-06-04) and its core functionality has been integrated directly into pytest itself. Modern pytest versions provide native cache support without requiring this external plugin. Installing this package on a current pytest setup risks API incompatibilities and maintenance gaps.
Use it for:
- Rerun only the tests that failed in the previous test session using --lf to speed up debugging cycles.
- Run all tests but execute previously failed tests first using --ff to surface regressions early.
- Cache expensive setup computations across multiple test runs via config.cache.set() and config.cache.get().
- Inspect cached test state and values using --cache to diagnose test history and cross-run dependencies.
- Clear all cached state before CI runs using --clearcache to ensure test isolation and correctness.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A pytest plugin that persists test state across runs, enabling rerun of only failed tests or failures-first execution via --lf and --ff flags, and providing a config.cache object for plugins to share values between test invocations.
No. This package is abandoned (last release 2013-06-04) and its functionality is now built into pytest natively. Installing it risks incompatibility with modern pytest versions and introduces unmaintained code into your test infrastructure. Use pytest's native cache support instead.
Install
pytest-cache on PyPI
pip
pip install pytest-cacheuv
uv add pytest-cachepoetry
poetry add pytest-cacheInstalling pytest-cache
Before you install
High install friction: the package is abandoned (last release 2013-06-04) with no maintenance signal. Modern pytest versions have integrated this functionality natively, making this package obsolete for current projects.
License in practice
MIT License (permissive) poses no legal barrier to use, but the abandoned status and age make licensing a secondary concern compared to functionality gaps.
Quickstart
pip install pytest-cache
# Then in conftest.py or a plugin:
def pytest_funcarg__mydata(request):
val = request.config.cache.get("example/value", None)
if val is None:
val = 42
request.config.cache.set("example/value", val)
return val
This package is abandoned and may be incompatible with modern pytest versions; native cache functionality is now integrated into pytest itself.
Verify before relying
- Compatibility with pytest versions released after 2013-06-04; whether API changes in modern pytest break this plugin.
- Whether the --lf and --ff flags still work as documented or have been superseded by pytest's native implementation.
- Current usability on Python 3 versions, given the package's alpha status and age.
Package facts
| License | MIT License (permissive) |
| Python support | not specified |
| Install friction | high — source build required |
| Runtime dependencies | none |
| Maintenance | abandoned — 4,819 days since the last release |
| First released | |
| Downloads | 687,699/month — #5,344 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pytest-cache-1.0.tar.gz
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
pytest-rerunfailuresA pytest plugin that automatically reruns…
copyleft · top 1,000 on PyPI
rtestA Python test runner built in Rust that uses…
permissive · top 15,000 on PyPI
pytest-retrypytest-retry is a pytest plugin that…
permissive · top 5,000 on PyPI
allpairspyGenerates minimal test case combinations using…
permissive · top 15,000 on PyPI
pytest-assumeA pytest plugin that collects and reports…
permissive · top 15,000 on PyPI
pytest-checkA pytest plugin that allows tests to continue…
unclear · top 5,000 on PyPI
pytest-watchRuns pytest continuously, re-executing tests…
permissive · top 5,000 on PyPI
pytest-onlyA pytest plugin that runs only tests marked…
permissive · top 15,000 on PyPI
pytest-skip-slowA pytest plugin that skips tests marked with…
permissive · top 15,000 on PyPI
tavernTavern is a pytest plugin and command-line tool…
permissive · top 15,000 on PyPI