diff options
Diffstat (limited to 'Lib/importlib/test')
-rw-r--r-- | Lib/importlib/test/import_/test_path.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Lib/importlib/test/import_/test_path.py b/Lib/importlib/test/import_/test_path.py index 70dae2f..6bace12 100644 --- a/Lib/importlib/test/import_/test_path.py +++ b/Lib/importlib/test/import_/test_path.py @@ -208,8 +208,16 @@ class FinderTests(unittest.TestCase): def test_path_hooks(self): # Test that sys.path_hooks is used. - # TODO(brett.cannon) implement - pass + # Test that sys.path_importer_cache is set. + module = '<test module>' + path = '<test path>' + importer = util.mock_modules(module) + hook = import_util.mock_path_hook(path, importer=importer) + with util.import_state(path_hooks=[hook]): + loader = machinery.PathFinder.find_module(module, [path]) + self.assert_(loader is importer) + self.assert_(path in sys.path_importer_cache) + self.assert_(sys.path_importer_cache[path] is importer) def test_implicit_hooks(self): # Test that the implicit path hooks are used. |