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

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

#countcontent
1n/afrom .. import abc
2n/afrom .. import util
3n/a
4n/amachinery = util.import_importlib('importlib.machinery')
5n/a
6n/aimport unittest
7n/aimport warnings
8n/a
9n/a
10n/aclass FinderTests(abc.FinderTests):
11n/a
12n/a """Test the finder for extension modules."""
13n/a
14n/a def find_module(self, fullname):
15n/a importer = self.machinery.FileFinder(util.EXTENSIONS.path,
16n/a (self.machinery.ExtensionFileLoader,
17n/a self.machinery.EXTENSION_SUFFIXES))
18n/a with warnings.catch_warnings():
19n/a warnings.simplefilter('ignore', DeprecationWarning)
20n/a return importer.find_module(fullname)
21n/a
22n/a def test_module(self):
23n/a self.assertTrue(self.find_module(util.EXTENSIONS.name))
24n/a
25n/a # No extension module as an __init__ available for testing.
26n/a test_package = test_package_in_package = None
27n/a
28n/a # No extension module in a package available for testing.
29n/a test_module_in_package = None
30n/a
31n/a # Extension modules cannot be an __init__ for a package.
32n/a test_package_over_module = None
33n/a
34n/a def test_failure(self):
35n/a self.assertIsNone(self.find_module('asdfjkl;'))
36n/a
37n/a
38n/a(Frozen_FinderTests,
39n/a Source_FinderTests
40n/a ) = util.test_both(FinderTests, machinery=machinery)
41n/a
42n/a
43n/aif __name__ == '__main__':
44n/a unittest.main()