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

Method test_missing_source

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

Source from the content-addressed store, hash-verified

1701
1702 @skip_if_dont_write_bytecode
1703 def test_missing_source(self):
1704 # With PEP 3147 cache layout, removing the source but leaving the pyc
1705 # file does not satisfy the import.
1706 __import__(TESTFN)
1707 pyc_file = importlib.util.cache_from_source(self.source)
1708 self.assertTrue(os.path.exists(pyc_file))
1709 os.remove(self.source)
1710 forget(TESTFN)
1711 importlib.invalidate_caches()
1712 self.assertRaises(ImportError, __import__, TESTFN)
1713
1714 @skip_if_dont_write_bytecode
1715 def test_missing_source_legacy(self):

Callers

nothing calls this directly

Calls 7

forgetFunction · 0.90
__import__Function · 0.85
assertTrueMethod · 0.80
existsMethod · 0.45
removeMethod · 0.45
invalidate_cachesMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected