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