mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 23:21:29 +00:00 
			
		
		
		
	importlib._bootstrap is now frozen into Python/importlib.h and stored as _frozen_importlib in sys.modules. Py_Initialize() loads the frozen code along with sys and imp and then uses _frozen_importlib._install() to set builtins.__import__() w/ _frozen_importlib.__import__().
		
			
				
	
	
		
			27 lines
		
	
	
	
		
			686 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
	
		
			686 B
		
	
	
	
		
			Python
		
	
	
	
	
	
from . import util as source_util
 | 
						|
 | 
						|
from importlib import _bootstrap
 | 
						|
import unittest
 | 
						|
 | 
						|
 | 
						|
class PathHookTest(unittest.TestCase):
 | 
						|
 | 
						|
    """Test the path hook for source."""
 | 
						|
 | 
						|
    def test_success(self):
 | 
						|
        with source_util.create_modules('dummy') as mapping:
 | 
						|
            self.assertTrue(hasattr(_bootstrap._file_path_hook(mapping['.root']),
 | 
						|
                                 'find_module'))
 | 
						|
 | 
						|
    def test_empty_string(self):
 | 
						|
        # The empty string represents the cwd.
 | 
						|
        self.assertTrue(hasattr(_bootstrap._file_path_hook(''), 'find_module'))
 | 
						|
 | 
						|
 | 
						|
def test_main():
 | 
						|
    from test.support import run_unittest
 | 
						|
    run_unittest(PathHookTest)
 | 
						|
 | 
						|
 | 
						|
if __name__ == '__main__':
 | 
						|
    test_main()
 |