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

Method unwritable_cache_dir

testing/test_cacheprovider.py:48–57  ·  view source on GitHub ↗
(self, pytester: Pytester)

Source from the content-addressed store, hash-verified

46
47 @pytest.fixture
48 def unwritable_cache_dir(self, pytester: Pytester) -> Generator[Path, None, None]:
49 cache_dir = pytester.path.joinpath(".pytest_cache")
50 cache_dir.mkdir()
51 mode = cache_dir.stat().st_mode
52 cache_dir.chmod(0)
53 if os.access(cache_dir, os.W_OK):
54 pytest.skip("Failed to make cache dir unwritable")
55
56 yield cache_dir
57 cache_dir.chmod(mode)
58
59 @pytest.mark.filterwarnings(
60 "ignore:could not create cache path:pytest.PytestWarning"

Callers

nothing calls this directly

Calls 1

mkdirMethod · 0.45

Tested by

no test coverage detected