[Python-checkins] r57449 - sandbox/trunk/import_in_py/zipimport_/tests.py

brett.cannon python-checkins at python.org
Sat Aug 25 06:01:21 CEST 2007


Author: brett.cannon
Date: Sat Aug 25 06:01:21 2007
New Revision: 57449

Modified:
   sandbox/trunk/import_in_py/zipimport_/tests.py
Log:
Make find_module tests more realistic.


Modified: sandbox/trunk/import_in_py/zipimport_/tests.py
==============================================================================
--- sandbox/trunk/import_in_py/zipimport_/tests.py	(original)
+++ sandbox/trunk/import_in_py/zipimport_/tests.py	Sat Aug 25 06:01:21 2007
@@ -89,6 +89,9 @@
         """Return what zipimporter.find_module() returns."""
         for args in [[True, True], [True, False], [False, True]]:
             with temp_zipfile(*args) as zip_path:
+                if '.' in module_name:
+                    zip_path = os.path.join(zip_path,
+                                            module_name.rsplit('.', 1)[0])
                 importer = zipimport.zipimporter(zip_path)
                 yield (importer, importer.find_module(module_name))
 
@@ -104,7 +107,7 @@
         # Finding a package should work.
         for importer, result in self.look_for('_pkg'):
             self.assert_(importer is result)
- 
+
     def test_submodule(self):
         # A submodule in a package should work.
         for importer, result in self.look_for('_pkg.submodule'):


More information about the Python-checkins mailing list