[Python-checkins] r69110 - in python/branches/py3k/Lib/importlib/test: abc.py builtin/test_finder.py extension/test_finder.py finder_tests.py frozen/test_finder.py loader_tests.py source/test_finder.py

brett.cannon python-checkins at python.org
Fri Jan 30 01:22:35 CET 2009


Author: brett.cannon
Date: Fri Jan 30 01:22:35 2009
New Revision: 69110

Log:
Merge testing ABCs for importlib into importlib.test.abc.


Added:
   python/branches/py3k/Lib/importlib/test/abc.py
Removed:
   python/branches/py3k/Lib/importlib/test/finder_tests.py
   python/branches/py3k/Lib/importlib/test/loader_tests.py
Modified:
   python/branches/py3k/Lib/importlib/test/builtin/test_finder.py
   python/branches/py3k/Lib/importlib/test/extension/test_finder.py
   python/branches/py3k/Lib/importlib/test/frozen/test_finder.py
   python/branches/py3k/Lib/importlib/test/source/test_finder.py

Added: python/branches/py3k/Lib/importlib/test/abc.py
==============================================================================
--- (empty file)
+++ python/branches/py3k/Lib/importlib/test/abc.py	Fri Jan 30 01:22:35 2009
@@ -0,0 +1,98 @@
+import abc
+import unittest
+
+
+class FinderTests(unittest.TestCase, metaclass=abc.ABCMeta):
+
+    """Basic tests for a finder to pass."""
+
+    @abc.abstractmethod
+    def test_module(self):
+        # Test importing a top-level module.
+        pass
+
+    @abc.abstractmethod
+    def test_package(self):
+        # Test importing a package.
+        pass
+
+    @abc.abstractmethod
+    def test_module_in_package(self):
+        # Test importing a module contained within a package.
+        # A value for 'path' should be used if for a meta_path finder.
+        pass
+
+    @abc.abstractmethod
+    def test_package_in_package(self):
+        # Test importing a subpackage.
+        # A value for 'path' should be used if for a meta_path finder.
+        pass
+
+    @abc.abstractmethod
+    def test_package_over_module(self):
+        # Test that packages are chosen over modules.
+        pass
+
+    @abc.abstractmethod
+    def test_failure(self):
+        # Test trying to find a module that cannot be handled.
+        pass
+
+
+class LoaderTests(unittest.TestCase, metaclass=abc.ABCMeta):
+
+    @abc.abstractmethod
+    def test_module(self):
+        """A module should load without issue.
+
+        After the loader returns the module should be in sys.modules.
+
+        Attributes to verify:
+
+            * __file__
+            * __loader__
+            * __name__
+            * No __path__
+
+        """
+        pass
+
+    @abc.abstractmethod
+    def test_package(self):
+        """Loading a package should work.
+
+        After the loader returns the module should be in sys.modules.
+
+        Attributes to verify:
+
+            * __file__
+            * __loader__
+            * __name__
+            * __path__
+
+        """
+        pass
+
+    @abc.abstractmethod
+    def test_lacking_parent(self):
+        """A loader should not be dependent on it's parent package being
+        imported."""
+        pass
+
+    @abc.abstractmethod
+    def test_module_reuse(self):
+        """If a module is already in sys.modules, it should be reused."""
+        pass
+
+    @abc.abstractmethod
+    def test_state_after_failure(self):
+        """If a module is already in sys.modules and a reload fails
+        (e.g. a SyntaxError), the module should be in the state it was before
+        the reload began."""
+        pass
+
+    @abc.abstractmethod
+    def test_unloadable(self):
+        """Test ImportError is raised when the loader is asked to load a module
+        it can't."""
+        pass

Modified: python/branches/py3k/Lib/importlib/test/builtin/test_finder.py
==============================================================================
--- python/branches/py3k/Lib/importlib/test/builtin/test_finder.py	(original)
+++ python/branches/py3k/Lib/importlib/test/builtin/test_finder.py	Fri Jan 30 01:22:35 2009
@@ -1,11 +1,11 @@
 from importlib import machinery
-from .. import finder_tests
+from .. import abc
 from .. import support
 
 import sys
 import unittest
 
-class FinderTests(finder_tests.FinderTests):
+class FinderTests(abc.FinderTests):
 
     """Test find_module() for built-in modules."""
 

Modified: python/branches/py3k/Lib/importlib/test/extension/test_finder.py
==============================================================================
--- python/branches/py3k/Lib/importlib/test/extension/test_finder.py	(original)
+++ python/branches/py3k/Lib/importlib/test/extension/test_finder.py	Fri Jan 30 01:22:35 2009
@@ -1,10 +1,10 @@
 import importlib
-from .. import finder_tests
+from .. import abc
 from . import test_path_hook
 
 import unittest
 
-class FinderTests(finder_tests.FinderTests):
+class FinderTests(abc.FinderTests):
 
     """Test the finder for extension modules."""
 

Deleted: python/branches/py3k/Lib/importlib/test/finder_tests.py
==============================================================================
--- python/branches/py3k/Lib/importlib/test/finder_tests.py	Fri Jan 30 01:22:35 2009
+++ (empty file)
@@ -1,39 +0,0 @@
-import abc
-import unittest
-
-
-class FinderTests(unittest.TestCase, metaclass=abc.ABCMeta):
-
-    """Basic tests for a finder to pass."""
-
-    @abc.abstractmethod
-    def test_module(self):
-        # Test importing a top-level module.
-        pass
-
-    @abc.abstractmethod
-    def test_package(self):
-        # Test importing a package.
-        pass
-
-    @abc.abstractmethod
-    def test_module_in_package(self):
-        # Test importing a module contained within a package.
-        # A value for 'path' should be used if for a meta_path finder.
-        pass
-
-    @abc.abstractmethod
-    def test_package_in_package(self):
-        # Test importing a subpackage.
-        # A value for 'path' should be used if for a meta_path finder.
-        pass
-
-    @abc.abstractmethod
-    def test_package_over_module(self):
-        # Test that packages are chosen over modules.
-        pass
-
-    @abc.abstractmethod
-    def test_failure(self):
-        # Test trying to find a module that cannot be handled.
-        pass

Modified: python/branches/py3k/Lib/importlib/test/frozen/test_finder.py
==============================================================================
--- python/branches/py3k/Lib/importlib/test/frozen/test_finder.py	(original)
+++ python/branches/py3k/Lib/importlib/test/frozen/test_finder.py	Fri Jan 30 01:22:35 2009
@@ -1,10 +1,10 @@
 from ... import machinery
-from .. import finder_tests
+from .. import abc
 
 import unittest
 
 
-class FinderTests(finder_tests.FinderTests):
+class FinderTests(abc.FinderTests):
 
     """Test finding frozen modules."""
 

Deleted: python/branches/py3k/Lib/importlib/test/loader_tests.py
==============================================================================
--- python/branches/py3k/Lib/importlib/test/loader_tests.py	Fri Jan 30 01:22:35 2009
+++ (empty file)
@@ -1,61 +0,0 @@
-import abc
-import unittest
-
-
-class LoaderTests(unittest.TestCase, metaclass=abc.ABCMeta):
-
-    @abc.abstractmethod
-    def test_module(self):
-        """A module should load without issue.
-
-        After the loader returns the module should be in sys.modules.
-
-        Attributes to verify:
-
-            * __file__
-            * __loader__
-            * __name__
-            * No __path__
-
-        """
-        pass
-
-    @abc.abstractmethod
-    def test_package(self):
-        """Loading a package should work.
-
-        After the loader returns the module should be in sys.modules.
-
-        Attributes to verify:
-
-            * __file__
-            * __loader__
-            * __name__
-            * __path__
-
-        """
-        pass
-
-    @abc.abstractmethod
-    def test_lacking_parent(self):
-        """A loader should not be dependent on it's parent package being
-        imported."""
-        pass
-
-    @abc.abstractmethod
-    def test_module_reuse(self):
-        """If a module is already in sys.modules, it should be reused."""
-        pass
-
-    @abc.abstractmethod
-    def test_state_after_failure(self):
-        """If a module is already in sys.modules and a reload fails
-        (e.g. a SyntaxError), the module should be in the state it was before
-        the reload began."""
-        pass
-
-    @abc.abstractmethod
-    def test_unloadable(self):
-        """Test ImportError is raised when the loader is asked to load a module
-        it can't."""
-        pass

Modified: python/branches/py3k/Lib/importlib/test/source/test_finder.py
==============================================================================
--- python/branches/py3k/Lib/importlib/test/source/test_finder.py	(original)
+++ python/branches/py3k/Lib/importlib/test/source/test_finder.py	Fri Jan 30 01:22:35 2009
@@ -1,5 +1,5 @@
 import importlib
-from .. import finder_tests
+from .. import abc
 from .. import support
 import os
 import py_compile
@@ -7,7 +7,7 @@
 import warnings
 
 
-class FinderTests(finder_tests.FinderTests):
+class FinderTests(abc.FinderTests):
 
     """For a top-level module, it should just be found directly in the
     directory being searched. This is true for a directory with source


More information about the Python-checkins mailing list