MCPcopy Index your code
hub / github.com/python/cpython / test_cached_readonly

Method test_cached_readonly

Lib/test/test_import/__init__.py:1340–1352  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1338 "test meaningful only on posix systems")
1339 @os_helper.skip_unless_working_chmod
1340 def test_cached_readonly(self):
1341 mode = 0o400
1342 with temp_umask(0o022), ready_to_import() as (name, path):
1343 cached_path = importlib.util.cache_from_source(path)
1344 os.chmod(path, mode)
1345 __import__(name)
1346 if not os.path.exists(cached_path):
1347 self.fail("__import__ did not result in creation of "
1348 "a .pyc file")
1349 stat_info = os.stat(cached_path)
1350
1351 expected = mode | 0o200 # Account for fix for issue #6074
1352 self.assertEqual(oct(stat.S_IMODE(stat_info.st_mode)), oct(expected))
1353
1354 def test_pyc_always_writable(self):
1355 # Initially read-only .pyc files on Windows used to cause problems

Callers

nothing calls this directly

Calls 8

temp_umaskFunction · 0.90
ready_to_importFunction · 0.90
__import__Function · 0.85
chmodMethod · 0.45
existsMethod · 0.45
failMethod · 0.45
statMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected