pytest-cache was an external plugin for pytest that provided mechanisms for caching data across test runs, including options to re-run only last failed tests (`--lf`) or run failed tests first (`--ff`), and a `config.cache` object for plugins to store and retrieve values. Its core functionality was integrated into pytest itself starting around versions 2.8 and 3.8. The last release of the standalone `pytest-cache` plugin was version 1.0 in June 2013, making it effectively abandoned as its features are now part of `pytest` core.
pip install pytest-cacheNo compatibility data collected yet for this library.
This quickstart demonstrates how to use the caching mechanisms directly provided by modern pytest, which supersede the `pytest-cache` plugin. It shows how to access the `cache` fixture, and common command-line options for test re-running and cache management.
Remove `pytest-cache` from your dependencies. Use `pytest`'s built-in `cache` fixture and command-line options. For example, `from _pytest.cacheprovider import Cache` is an internal import, but the `cache` fixture is the public API.
Do not install `pytest-cache`. Ensure your `pytest` installation is up-to-date to benefit from the integrated caching features.
Ensure `.pytest_cache/` is added to your project's `.gitignore` if `pytest` does not automatically create one, to prevent committing cache files. Understand that `pytest` manages this directory for cross-session state.
Remove the `pytest-cache` dependency from your project's requirements and update any code that explicitly imports it. Use `pytest`'s built-in caching mechanism (e.g., via `request.config.cache`) directly.
Upgrade `pytest` to a modern version (e.g., `pip install --upgrade pytest`). The `--lf` option has been part of core `pytest` since version 2.8, and `--ff` (failed first) since 3.8.
Uninstall the standalone `pytest-cache` plugin (`pip uninstall pytest-cache`). The caching features, including `--lf`, `--ff`, and `request.config.cache`, are available directly through your `pytest` installation.
No dependency data recorded yet.