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

Method test_missing_source_legacy

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

Source from the content-addressed store, hash-verified

1713
1714 @skip_if_dont_write_bytecode
1715 def test_missing_source_legacy(self):
1716 # Like test_missing_source() except that for backward compatibility,
1717 # when the pyc file lives where the py file would have been (and named
1718 # without the tag), it is importable. The __file__ of the imported
1719 # module is the pyc location.
1720 __import__(TESTFN)
1721 # pyc_file gets removed in _clean() via tearDown().
1722 pyc_file = make_legacy_pyc(self.source)
1723 os.remove(self.source)
1724 unload(TESTFN)
1725 importlib.invalidate_caches()
1726 m = __import__(TESTFN)
1727 try:
1728 self.assertEqual(m.__file__,
1729 os.path.join(os.getcwd(), os.path.relpath(pyc_file)))
1730 finally:
1731 os.remove(pyc_file)
1732
1733 def test_recompute_pyc_same_second(self):
1734 # Even when the source file doesn't change timestamp, a change in

Callers

nothing calls this directly

Calls 7

make_legacy_pycFunction · 0.90
unloadFunction · 0.90
__import__Function · 0.85
removeMethod · 0.45
invalidate_cachesMethod · 0.45
assertEqualMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected