| 
									
										
										
										
											2009-03-12 22:47:53 +00:00
										 |  |  | from importlib import _bootstrap | 
					
						
							| 
									
										
										
										
											2009-02-07 02:06:43 +00:00
										 |  |  | from . import util | 
					
						
							| 
									
										
										
										
											2009-01-18 00:24:28 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 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): | 
					
						
							| 
									
										
										
										
											2010-07-03 21:48:25 +00:00
										 |  |  |         return _bootstrap._file_path_hook(entry) | 
					
						
							| 
									
										
										
										
											2009-01-18 00:24:28 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def test_success(self): | 
					
						
							|  |  |  |         # Path hook should handle a directory where a known extension module | 
					
						
							|  |  |  |         # exists. | 
					
						
							| 
									
										
										
										
											2009-06-30 23:06:06 +00:00
										 |  |  |         self.assertTrue(hasattr(self.hook(util.PATH), 'find_module')) | 
					
						
							| 
									
										
										
										
											2009-01-18 00:24:28 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | def test_main(): | 
					
						
							|  |  |  |     from test.support import run_unittest | 
					
						
							|  |  |  |     run_unittest(PathHookTests) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if __name__ == '__main__': | 
					
						
							|  |  |  |     test_main() |