docs: guard pytestconfig.cache example when cacheprovider is disabled by mitre88 · Pull Request #14254 · pytest-dev/pytest

  • Include documentation when adding new features.
  • Include new tests or update existing tests when applicable.
  • Allow maintainers to push and squash when merging my commits.

Description

Update the config.cache example in doc/en/how-to/cache.rst to safely handle cases where the cacheprovider plugin is disabled.

The fixture now uses getattr(pytestconfig, "cache", None) and falls back gracefully when cache support is unavailable, which avoids AttributeError in the documented pattern.

Closes #14148