diff options
author | Brett Cannon <brett@python.org> | 2012-08-10 16:21:12 (GMT) |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2012-08-10 16:21:12 (GMT) |
commit | f4dc9204cc406ab41c2d643c1a64375a6a2954e5 (patch) | |
tree | c0cf92198b707bac6a68b801305ad86b24eb814f /Lib/test/test_importlib/test_api.py | |
parent | 2d6266d5f148549979df024459e29b73307b86c4 (diff) | |
download | cpython-f4dc9204cc406ab41c2d643c1a64375a6a2954e5.zip cpython-f4dc9204cc406ab41c2d643c1a64375a6a2954e5.tar.gz cpython-f4dc9204cc406ab41c2d643c1a64375a6a2954e5.tar.bz2 |
Issue #15502: Finish bringing importlib.abc in line with the current
state of the import system. Also make importlib.invalidate_caches()
work with sys.meta_path instead of sys.path_importer_cache to
completely separate the path-based import system from the overall
import system.
Patch by Eric Snow.
Diffstat (limited to 'Lib/test/test_importlib/test_api.py')
-rw-r--r-- | Lib/test/test_importlib/test_api.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Lib/test/test_importlib/test_api.py b/Lib/test/test_importlib/test_api.py index ba2a721..ef6629a 100644 --- a/Lib/test/test_importlib/test_api.py +++ b/Lib/test/test_importlib/test_api.py @@ -148,11 +148,15 @@ class InvalidateCacheTests(unittest.TestCase): self.called = True key = 'gobledeegook' - ins = InvalidatingNullFinder() - sys.path_importer_cache[key] = ins + meta_ins = InvalidatingNullFinder() + path_ins = InvalidatingNullFinder() + sys.meta_path.insert(0, meta_ins) self.addCleanup(lambda: sys.path_importer_cache.__delitem__(key)) + sys.path_importer_cache[key] = path_ins + self.addCleanup(lambda: sys.meta_path.remove(meta_ins)) importlib.invalidate_caches() - self.assertTrue(ins.called) + self.assertTrue(meta_ins.called) + self.assertTrue(path_ins.called) def test_method_lacking(self): # There should be no issues if the method is not defined. |