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