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