mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	 938d44d59c
			
		
	
	
		938d44d59c
		
	
	
	
	
		
			
			importlib.machinery.(FileFinder, SourceFileLoader, _SourcelessFileLoader, ExtensionFileLoader). This exposes all of importlib's mechanisms that will become public on the sys module.
		
			
				
	
	
		
			32 lines
		
	
	
	
		
			855 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
	
		
			855 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| from importlib import _bootstrap
 | |
| from . import util
 | |
| 
 | |
| import collections
 | |
| import imp
 | |
| import sys
 | |
| import unittest
 | |
| 
 | |
| 
 | |
| class PathHookTests(unittest.TestCase):
 | |
| 
 | |
|     """Test the path hook for extension modules."""
 | |
|     # XXX Should it only succeed for pre-existing directories?
 | |
|     # XXX Should it only work for directories containing an extension module?
 | |
| 
 | |
|     def hook(self, entry):
 | |
|         return _bootstrap.FileFinder.path_hook((_bootstrap.ExtensionFileLoader,
 | |
|             _bootstrap._suffix_list(imp.C_EXTENSION), False))(entry)
 | |
| 
 | |
|     def test_success(self):
 | |
|         # Path hook should handle a directory where a known extension module
 | |
|         # exists.
 | |
|         self.assertTrue(hasattr(self.hook(util.PATH), 'find_module'))
 | |
| 
 | |
| 
 | |
| def test_main():
 | |
|     from test.support import run_unittest
 | |
|     run_unittest(PathHookTests)
 | |
| 
 | |
| 
 | |
| if __name__ == '__main__':
 | |
|     test_main()
 |