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

Function pytest_report_header

src/_pytest/cacheprovider.py:525–538  ·  view source on GitHub ↗

Display cachedir with --cache-show and if non-default.

(config: Config)

Source from the content-addressed store, hash-verified

523
524
525def pytest_report_header(config: Config) -> Optional[str]:
526 """Display cachedir with --cache-show and if non-default."""
527 if config.option.verbose > 0 or config.getini("cache_dir") != ".pytest_cache":
528 assert config.cache is not None
529 cachedir = config.cache._cachedir
530 # TODO: evaluate generating upward relative paths
531 # starting with .., ../.. if sensible
532
533 try:
534 displaypath = cachedir.relative_to(config.rootpath)
535 except ValueError:
536 displaypath = cachedir
537 return f"cachedir: {displaypath}"
538 return None
539
540
541def cacheshow(config: Config, session: Session) -> int:

Callers

nothing calls this directly

Calls 1

getiniMethod · 0.45

Tested by

no test coverage detected