mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	 5abdc93eb8
			
		
	
	
		5abdc93eb8
		
	
	
	
	
		
			
			FrozenImporter. Docs forthcoming. I plan on all finders and loaders (and most likely hooks) to live in imoprtlib.machinery. Utility stuff will end up in importlib.util. Higher-level API stuff will stay on imoprtlib directly (e.g. import_module).
		
			
				
	
	
		
			36 lines
		
	
	
	
		
			872 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
	
		
			872 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| from importlib import machinery
 | |
| from .. import support
 | |
| 
 | |
| import sys
 | |
| import unittest
 | |
| 
 | |
| class FinderTests(unittest.TestCase):
 | |
| 
 | |
|     """Test find_module() for built-in modules."""
 | |
| 
 | |
|     assert 'errno' in sys.builtin_module_names
 | |
|     name = 'errno'
 | |
| 
 | |
|     find_module = staticmethod(lambda name, path=None:
 | |
|                     machinery.BuiltinImporter.find_module(name, path))
 | |
| 
 | |
| 
 | |
|     def test_find_module(self):
 | |
|         # Common case.
 | |
|         with support.uncache(self.name):
 | |
|             self.assert_(self.find_module(self.name))
 | |
| 
 | |
|     def test_ignore_path(self):
 | |
|         # The value for 'path' should always trigger a failed import.
 | |
|         with support.uncache(self.name):
 | |
|             self.assert_(self.find_module(self.name, ['pkg']) is None)
 | |
| 
 | |
| 
 | |
| 
 | |
| def test_main():
 | |
|     from test.support import run_unittest
 | |
|     run_unittest(FinderTests)
 | |
| 
 | |
| 
 | |
| if __name__ == '__main__':
 | |
|     test_main()
 |