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

Method test_cache_dir_permissions

testing/test_cacheprovider.py:34–47  ·  view source on GitHub ↗

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 """The .pytest_cache directory should have world-readable permissions
36 (depending on umask).
37
38 Regression test for #12308.
39 """
40 pytester.makeini("[pytest]")
41 config = pytester.parseconfigure()
42 assert config.cache is not None
43 p = config.cache.mkdir("name")
44 assert p.is_dir()
45 # Instead of messing with umask, make sure .pytest_cache has the same
46 # 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("[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