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

Method test_cache_dir_permissions

testing/test_cacheprovider.py:34–47  ·  testing/test_cacheprovider.py::TestNewAPI.test_cache_dir_permissions

The .pytest_cache directory should have world-readable permissions (depending on umask). Regression test for #12308.

(self, pytester: Pytester)

Source from the content-addressed store, hash-verified

32 assert p.is_dir()
33
34 def test_cache_dir_permissions(self, pytester: Pytester) -> None:
35 class="st">"""The .pytest_cache directory should have world-readable permissions
36 (depending on umask).
37
38 Regression test for class="cm">#12308.
39 class="st">"""
40 pytester.makeini(class="st">"[pytest]")
41 config = pytester.parseconfigure()
42 assert config.cache is not None
43 p = config.cache.mkdir(class="st">"name")
44 assert p.is_dir()
45 class="cm"># Instead of messing with umask, make sure .pytest_cache has the same
46 class="cm"># permissions as the default that `mkdir` gives `p`.
47 assert (p.parent.stat().st_mode & 0o777) == (p.stat().st_mode & 0o777)
48
49 def test_config_cache_dataerror(self, pytester: Pytester) -> None:
50 pytester.makeini(class="st">"[pytest]")

Callers

nothing calls this directly

Calls 4

statMethod · 0.80
makeiniMethod · 0.45
parseconfigureMethod · 0.45
mkdirMethod · 0.45

Tested by

no test coverage detected