Skip to content

docs: guard pytestconfig.cache example when cacheprovider is disabled#14254

Open
mitre88 wants to merge 3 commits intopytest-dev:mainfrom
mitre88:codex/issue-14148-cache-doc-safe-access
Open

docs: guard pytestconfig.cache example when cacheprovider is disabled#14254
mitre88 wants to merge 3 commits intopytest-dev:mainfrom
mitre88:codex/issue-14148-cache-doc-safe-access

Conversation

@mitre88
Copy link
Contributor

@mitre88 mitre88 commented Mar 5, 2026

  • 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

@psf-chronographer psf-chronographer bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Mar 5, 2026
@nicoddemus
Copy link
Member

Thanks!

@nicoddemus nicoddemus enabled auto-merge (squash) March 6, 2026 12:53
@nicoddemus nicoddemus added the backport 9.0.x apply to PRs at any point; backports the changes to the 9.0.x branch label Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport 9.0.x apply to PRs at any point; backports the changes to the 9.0.x branch bot:chronographer:provided (automation) changelog entry is part of PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

documentation recommends accessing config.cache in an unsafe way

2 participants