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

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

#countcontent
1n/afrom .. import util
2n/a
3n/amachinery = util.import_importlib('importlib.machinery')
4n/a
5n/aimport unittest
6n/a
7n/a
8n/aclass PathHookTests:
9n/a
10n/a """Test the path hook for extension modules."""
11n/a # XXX Should it only succeed for pre-existing directories?
12n/a # XXX Should it only work for directories containing an extension module?
13n/a
14n/a def hook(self, entry):
15n/a return self.machinery.FileFinder.path_hook(
16n/a (self.machinery.ExtensionFileLoader,
17n/a self.machinery.EXTENSION_SUFFIXES))(entry)
18n/a
19n/a def test_success(self):
20n/a # Path hook should handle a directory where a known extension module
21n/a # exists.
22n/a self.assertTrue(hasattr(self.hook(util.EXTENSIONS.path), 'find_module'))
23n/a
24n/a
25n/a(Frozen_PathHooksTests,
26n/a Source_PathHooksTests
27n/a ) = util.test_both(PathHookTests, machinery=machinery)
28n/a
29n/a
30n/aif __name__ == '__main__':
31n/a unittest.main()