ยปCore Development>Code coverage>Lib/importlib/test/extension/test_path_hook.py

Python code coverage for Lib/importlib/test/extension/test_path_hook.py

#countcontent
1n/afrom importlib import _bootstrap
2n/afrom . import util
3n/a
4n/aimport collections
5n/aimport imp
6n/aimport sys
7n/aimport unittest
8n/a
9n/a
10n/aclass PathHookTests(unittest.TestCase):
11n/a
12n/a """Test the path hook for extension modules."""
13n/a # XXX Should it only succeed for pre-existing directories?
14n/a # XXX Should it only work for directories containing an extension module?
15n/a
16n/a def hook(self, entry):
17n/a return _bootstrap.FileFinder.path_hook((_bootstrap.ExtensionFileLoader,
18n/a imp.extension_suffixes(), False))(entry)
19n/a
20n/a def test_success(self):
21n/a # Path hook should handle a directory where a known extension module
22n/a # exists.
23n/a self.assertTrue(hasattr(self.hook(util.PATH), 'find_module'))
24n/a
25n/a
26n/adef test_main():
27n/a from test.support import run_unittest
28n/a run_unittest(PathHookTests)
29n/a
30n/a
31n/aif __name__ == '__main__':
32n/a test_main()