mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 03:44:55 +00:00 
			
		
		
		
	+ Ditch using arguments to super(). + Ditch subclassing from object directly. + Move directory check out of chaining path hook to file path hook/finder. + Rename some classes to better reflect they are finders, not importers.
		
			
				
	
	
		
			31 lines
		
	
	
	
		
			739 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
	
		
			739 B
		
	
	
	
		
			Python
		
	
	
	
	
	
import importlib
 | 
						|
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 importlib.ExtensionFileFinder(entry)
 | 
						|
 | 
						|
    def test_success(self):
 | 
						|
        # Path hook should handle a directory where a known extension module
 | 
						|
        # exists.
 | 
						|
        self.assert_(hasattr(self.hook(util.PATH), 'find_module'))
 | 
						|
 | 
						|
 | 
						|
def test_main():
 | 
						|
    from test.support import run_unittest
 | 
						|
    run_unittest(PathHookTests)
 | 
						|
 | 
						|
 | 
						|
if __name__ == '__main__':
 | 
						|
    test_main()
 |