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