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

Method test_creation_mode

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

Source from the content-addressed store, hash-verified

1303 "Emscripten's/WASI's umask is a stub."
1304 )
1305 def test_creation_mode(self):
1306 mask = 0o022
1307 with temp_umask(mask), ready_to_import() as (name, path):
1308 cached_path = importlib.util.cache_from_source(path)
1309 module = __import__(name)
1310 if not os.path.exists(cached_path):
1311 self.fail("__import__ did not result in creation of "
1312 "a .pyc file")
1313 stat_info = os.stat(cached_path)
1314
1315 # Check that the umask is respected, and the executable bits
1316 # aren't set.
1317 self.assertEqual(oct(stat.S_IMODE(stat_info.st_mode)),
1318 oct(0o666 & ~mask))
1319
1320 @unittest.skipUnless(os.name == 'posix',
1321 "test meaningful only on posix systems")

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected