[Python-checkins] r52946 - sandbox/trunk/import_in_py/importer.py sandbox/trunk/import_in_py/mock_importer.py sandbox/trunk/import_in_py/test_importer.py

brett.cannon python-checkins at python.org
Thu Dec 7 01:09:56 CET 2006


Author: brett.cannon
Date: Thu Dec  7 01:09:55 2006
New Revision: 52946

Modified:
   sandbox/trunk/import_in_py/importer.py
   sandbox/trunk/import_in_py/mock_importer.py
   sandbox/trunk/import_in_py/test_importer.py
Log:
Remove third argument from load_module().


Modified: sandbox/trunk/import_in_py/importer.py
==============================================================================
--- sandbox/trunk/import_in_py/importer.py	(original)
+++ sandbox/trunk/import_in_py/importer.py	Thu Dec  7 01:09:55 2006
@@ -29,7 +29,17 @@
 XXX Semantics
 =============
 * Case-insensitive filesystems.
-  
+* Raise ImportWarning when trying to import a directory that does not have a __init__.py.
+
+XXX Failing tests
+=================
+* test_import
+* test_importhooks
+* test_pkg
+* test_runpy
+* test_traceback
+* test_zipimport
+
 
 Things to be exposed at the Python level
 ========================================
@@ -188,7 +198,7 @@
             return None
 
     @classmethod
-    def load_module(cls, fullname, path=None):
+    def load_module(cls, fullname):
         """Load a built-in or frozen module.
 
         'imp' code for loading a built-in or frozen module handles the setting
@@ -313,7 +323,7 @@
         self.handler = handler
         self.package = package
 
-    def load_module(self, fullname, path=None):
+    def load_module(self, fullname):
         """Load the module from self.path using self.handler.
         
         The handler is expected to implement a handle_code method that will
@@ -671,7 +681,7 @@
             loader = self.search_std_path(name, path)
         # A loader was found.  It is the loader's responsibility to have put an
         # entry in sys.modules.
-        return loader.load_module(name, path)
+        return loader.load_module(name)
 
     def import_full_module(self, name):
         """Import a module along with its parent modules and set into

Modified: sandbox/trunk/import_in_py/mock_importer.py
==============================================================================
--- sandbox/trunk/import_in_py/mock_importer.py	(original)
+++ sandbox/trunk/import_in_py/mock_importer.py	Thu Dec  7 01:09:55 2006
@@ -134,9 +134,9 @@
 
         return True
             
-    def load_module(self, fullname, path=None):
+    def load_module(self, fullname):
         """Return what the method was called with."""
-        return fullname, path
+        return fullname
     
     @log_call
     def split_path(self, path):
@@ -255,9 +255,9 @@
         self.find_request = fullname, path
         return self
 
-    def load_module(self, fullname, path=None):
-        self.load_request = fullname, path
-        module = MockModule(fullname, '<succeed importer>', path)
+    def load_module(self, fullname):
+        self.load_request = fullname
+        module = MockModule(fullname, '<succeed importer>')
         self.loaded_modules.append(module)
         sys.modules[fullname] = module
         return module

Modified: sandbox/trunk/import_in_py/test_importer.py
==============================================================================
--- sandbox/trunk/import_in_py/test_importer.py	(original)
+++ sandbox/trunk/import_in_py/test_importer.py	Thu Dec  7 01:09:55 2006
@@ -1076,7 +1076,7 @@
         self.importer(full_module_name)
         self.failUnless(full_module_name in sys.modules)
         self.failUnlessEqual(succeed_importer.find_request, lookup_args)
-        self.failUnlessEqual(succeed_importer.load_request, lookup_args)
+        self.failUnlessEqual(succeed_importer.load_request, lookup_args[0])
 
 
 class ImportStdPathTests(ImportHelper):


More information about the Python-checkins mailing list