skillfed

pytest-cache

pytest plugin with mechanisms for caching across test runs

pytest-cache v1.0 687.7K downloads/30d#5,344 on PyPI
Permissive license MIT License Abandoned released

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-cache

uv

uv add pytest-cache

poetry

poetry add pytest-cache

Installing 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

Development Status :: 3 - AlphaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIXProgramming Language :: PythonProgramming Language :: Python :: 3Topic :: Software Development :: LibrariesTopic :: Software Development :: TestingTopic :: Utilities

Tags

pytest cache pluginrerun failed testspytest state persistencecross-testrun cachingpytest failure trackingtest result cachingpytest --lf --ff
deprecatedlegacy

More Libraries packages