[Python-checkins] r69166 - in python/branches/py3k/Lib/importlib: NOTES test/extension/test_loader.py

brett.cannon python-checkins at python.org
Sun Feb 1 01:49:41 CET 2009


Author: brett.cannon
Date: Sun Feb  1 01:49:41 2009
New Revision: 69166

Log:
Move extension module loader tests over to importlib.test.abc.LoaderTests.

Modified:
   python/branches/py3k/Lib/importlib/NOTES
   python/branches/py3k/Lib/importlib/test/extension/test_loader.py

Modified: python/branches/py3k/Lib/importlib/NOTES
==============================================================================
--- python/branches/py3k/Lib/importlib/NOTES	(original)
+++ python/branches/py3k/Lib/importlib/NOTES	Sun Feb  1 01:49:41 2009
@@ -4,7 +4,6 @@
 * Use test.abc.LoaderTests
 
     + frozen
-    + extension
     + source
 
 * Reorganize support code.

Modified: python/branches/py3k/Lib/importlib/test/extension/test_loader.py
==============================================================================
--- python/branches/py3k/Lib/importlib/test/extension/test_loader.py	(original)
+++ python/branches/py3k/Lib/importlib/test/extension/test_loader.py	Sun Feb  1 01:49:41 2009
@@ -1,12 +1,13 @@
 import importlib
 from . import test_path_hook
+from .. import abc
 from .. import support
 
 import sys
 import unittest
 
 
-class LoaderTests(unittest.TestCase):
+class LoaderTests(abc.LoaderTests):
 
     """Test load_module() for extension modules."""
 
@@ -16,7 +17,7 @@
                                                 False)
         return loader.load_module(fullname)
 
-    def test_success(self):
+    def test_module(self):
         with support.uncache(test_path_hook.NAME):
             module = self.load_module(test_path_hook.NAME)
             for attr, value in [('__name__', test_path_hook.NAME),
@@ -24,7 +25,25 @@
                 self.assertEqual(getattr(module, attr), value)
             self.assert_(test_path_hook.NAME in sys.modules)
 
-    def test_failure(self):
+    def test_package(self):
+        # Extensions are not found in packages.
+        pass
+
+    def test_lacking_parent(self):
+        # Extensions are not found in packages.
+        pass
+
+    def test_module_reuse(self):
+        with support.uncache(test_path_hook.NAME):
+            module1 = self.load_module(test_path_hook.NAME)
+            module2 = self.load_module(test_path_hook.NAME)
+            self.assert_(module1 is module2)
+
+    def test_state_after_failure(self):
+        # No easy way to trigger a failure after a successful import.
+        pass
+
+    def test_unloadable(self):
         self.assertRaises(ImportError, self.load_module, 'asdfjkl;')
 
 


More information about the Python-checkins mailing list