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

Method for_config

src/_pytest/cacheprovider.py:75–84  ·  view source on GitHub ↗

Create the Cache instance for a Config. :meta private:

(cls, config: Config, *, _ispytest: bool = False)

Source from the content-addressed store, hash-verified

73
74 @classmethod
75 def for_config(cls, config: Config, *, _ispytest: bool = False) -> "Cache":
76 """Create the Cache instance for a Config.
77
78 :meta private:
79 """
80 check_ispytest(_ispytest)
81 cachedir = cls.cache_dir_from_config(config, _ispytest=True)
82 if config.getoption("cacheclear") and cachedir.is_dir():
83 cls.clear_cache(cachedir, _ispytest=True)
84 return cls(cachedir, config, _ispytest=True)
85
86 @classmethod
87 def clear_cache(cls, cachedir: Path, _ispytest: bool = False) -> None:

Callers 5

pytest_configureFunction · 0.80
test_gitignoreFunction · 0.80
test_preserve_keys_orderFunction · 0.80
test_cachedir_tagFunction · 0.80

Calls 5

check_ispytestFunction · 0.90
clsFunction · 0.85
cache_dir_from_configMethod · 0.80
clear_cacheMethod · 0.80
getoptionMethod · 0.45

Tested by 4

test_gitignoreFunction · 0.64
test_preserve_keys_orderFunction · 0.64
test_cachedir_tagFunction · 0.64