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

Method test_readonly

testing/test_assertrewrite.py:1063–1076  ·  testing/test_assertrewrite.py::TestRewriteOnImport.test_readonly
(self, pytester: Pytester)

Source from the content-addressed store, hash-verified

1061 assert pytester.runpytest(class="st">"-vv").ret == ExitCode.OK
1062
1063 def test_readonly(self, pytester: Pytester) -> None:
1064 sub = pytester.mkdir(class="st">"testing")
1065 sub.joinpath(class="st">"test_readonly.py").write_bytes(
1066 bclass="st">"""
1067def test_rewritten():
1068 assert class="st">"@py_builtins" in globals()
1069 class="st">""",
1070 )
1071 old_mode = sub.stat().st_mode
1072 sub.chmod(320)
1073 try:
1074 assert pytester.runpytest().ret == 0
1075 finally:
1076 sub.chmod(old_mode)
1077
1078 def test_dont_write_bytecode(self, pytester: Pytester, monkeypatch) -> None:
1079 monkeypatch.delenv(class="st">"PYTHONPYCACHEPREFIX", raising=False)

Callers

nothing calls this directly

Calls 4

statMethod · 0.80
chmodMethod · 0.80
mkdirMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected