MCPcopy Create free account
hub / github.com/pytest-dev/pytest / cache

Function cache

src/_pytest/cacheprovider.py:510–522  ·  view source on GitHub ↗

Return a cache object that can persist state between testing sessions. cache.get(key, default) cache.set(key, value) Keys must be ``/`` separated strings, where the first part is usually the name of your plugin or application to avoid clashes with other cache users. Values can

(request: FixtureRequest)

Source from the content-addressed store, hash-verified

508
509@fixture
510def cache(request: FixtureRequest) -> Cache:
511 """Return a cache object that can persist state between testing sessions.
512
513 cache.get(key, default)
514 cache.set(key, value)
515
516 Keys must be ``/`` separated strings, where the first part is usually the
517 name of your plugin or application to avoid clashes with other cache users.
518
519 Values can be any object handled by the json stdlib module.
520 """
521 assert request.config.cache is not None
522 return request.config.cache
523
524
525def pytest_report_header(config: Config) -> Optional[str]:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected