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

Method test_path_hooks

Lib/test/test_importlib/import_/test_path.py:59–70  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

57 self.assertIsNone(self.find('module', []))
58
59 def test_path_hooks(self):
60 # Test that sys.path_hooks is used.
61 # Test that sys.path_importer_cache is set.
62 module = '<test module>'
63 path = '<test path>'
64 importer = util.mock_spec(module)
65 hook = util.mock_path_hook(path, importer=importer)
66 with util.import_state(path_hooks=[hook]):
67 found = self.find(module, [path])
68 self.check_found(found, importer)
69 self.assertIn(path, sys.path_importer_cache)
70 self.assertIs(sys.path_importer_cache[path], importer)
71
72 def test_empty_path_hooks(self):
73 # Test that if sys.path_hooks is empty a warning is raised,

Callers

nothing calls this directly

Calls 4

assertInMethod · 0.80
findMethod · 0.45
check_foundMethod · 0.45
assertIsMethod · 0.45

Tested by

no test coverage detected