[Python-checkins] r57231 - sandbox/trunk/import_in_py/tests/test_fs_loader.py

brett.cannon python-checkins at python.org
Tue Aug 21 03:53:11 CEST 2007


Author: brett.cannon
Date: Tue Aug 21 03:53:11 2007
New Revision: 57231

Modified:
   sandbox/trunk/import_in_py/tests/test_fs_loader.py
Log:
Implement a very basic package test for the source loader.


Modified: sandbox/trunk/import_in_py/tests/test_fs_loader.py
==============================================================================
--- sandbox/trunk/import_in_py/tests/test_fs_loader.py	(original)
+++ sandbox/trunk/import_in_py/tests/test_fs_loader.py	Tue Aug 21 03:53:11 2007
@@ -28,7 +28,8 @@
         loaded = loader.load_module(name)
         self.assert_(loaded is sys.modules[name])
         self.assertEqual(loaded.__name__, name)
-        self.assert_(loaded.__file__.startswith(path))
+        self.assert_(loaded.__file__.startswith(path),
+                        "%s does not start with %s" % (loaded.__file__, path))
         self.assertEqual(loaded.__loader__, loader)
 
     def ImportError_on_bad_name(self, loader, bad_name, extra_methods=[]):
@@ -88,7 +89,9 @@
         self.basic_test(loader, self.module_name, self.py_path)
 
     def test_pkg_basic(self):
-        raise NotImplementedError
+        loader = importlib._PyFileLoader(self.pkg_name, self.pkg_init_path,
+                                            True)
+        self.basic_test(loader, self.pkg_name, self.pkg_init_path)
 
     def test_reload(self):
         loader = importlib._PyFileLoader(self.module_name, self.py_path, False)


More information about the Python-checkins mailing list