MCPcopy
hub / github.com/pytest-dev/pytest / for_config

Method for_config

src/_pytest/cacheprovider.py:111–120  ·  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

109
110 @classmethod
111 def for_config(cls, config: Config, *, _ispytest: bool = False) -> Cache:
112 """Create the Cache instance for a Config.
113
114 :meta private:
115 """
116 check_ispytest(_ispytest)
117 cachedir = cls.cache_dir_from_config(config, _ispytest=True)
118 if config.getoption("cacheclear") and cachedir.is_dir():
119 cls.clear_cache(cachedir, _ispytest=True)
120 return cls(cachedir, config, _ispytest=True)
121
122 @classmethod
123 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
getoptionMethod · 0.80
clear_cacheMethod · 0.80

Tested by 4

test_gitignoreFunction · 0.64
test_preserve_keys_orderFunction · 0.64
test_cachedir_tagFunction · 0.64