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

Method unwritable_cache_dir

testing/test_cacheprovider.py:73–82  ·  testing/test_cacheprovider.py::TestNewAPI.unwritable_cache_dir
(self, pytester: Pytester)

Source from the content-addressed store, hash-verified

71
72 @pytest.fixture
73 def unwritable_cache_dir(self, pytester: Pytester) -> Generator[Path]:
74 cache_dir = pytester.path.joinpath(class="st">".pytest_cache")
75 cache_dir.mkdir()
76 mode = cache_dir.stat().st_mode
77 cache_dir.chmod(0)
78 if os.access(cache_dir, os.W_OK):
79 pytest.skip(class="st">"Failed to make cache dir unwritable")
80
81 yield cache_dir
82 cache_dir.chmod(mode)
83
84 @pytest.mark.filterwarnings(
85 class="st">"ignore:could not create cache path:pytest.PytestWarning"

Callers

nothing calls this directly

Calls 3

statMethod · 0.80
chmodMethod · 0.80
mkdirMethod · 0.45

Tested by

no test coverage detected