summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_importlib
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2012-08-02 11:26:03 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2012-08-02 11:26:03 (GMT)
commit8a9080feffc757360d0d73e4173189586098ffb5 (patch)
tree9199a6a30f436fcc310ad16ff64f145f00822e2c /Lib/test/test_importlib
parenta90f311d0592f6ab56068441413a1925bd7393f4 (diff)
downloadcpython-8a9080feffc757360d0d73e4173189586098ffb5.zip
cpython-8a9080feffc757360d0d73e4173189586098ffb5.tar.gz
cpython-8a9080feffc757360d0d73e4173189586098ffb5.tar.bz2
Issue #15502: Bring the importlib ABCs into line with the current state of the import protocols given PEP 420. Original patch by Eric Snow.
Diffstat (limited to 'Lib/test/test_importlib')
-rw-r--r--Lib/test/test_importlib/source/test_abc_loader.py21
-rw-r--r--Lib/test/test_importlib/test_abc.py7
2 files changed, 21 insertions, 7 deletions
diff --git a/Lib/test/test_importlib/source/test_abc_loader.py b/Lib/test/test_importlib/source/test_abc_loader.py
index 9db4882..0d912b6 100644
--- a/Lib/test/test_importlib/source/test_abc_loader.py
+++ b/Lib/test/test_importlib/source/test_abc_loader.py
@@ -778,23 +778,32 @@ class SourceLoaderGetSourceTests(unittest.TestCase):
expect = io.IncrementalNewlineDecoder(None, True).decode(source)
self.assertEqual(mock.get_source(name), expect)
+
class AbstractMethodImplTests(unittest.TestCase):
"""Test the concrete abstractmethod implementations."""
- class Loader(abc.Loader):
- def load_module(self, fullname):
- super().load_module(fullname)
- def module_repr(self, module):
- super().module_repr(module)
+ class MetaPathFinder(abc.MetaPathFinder):
+ def find_module(self, fullname, path):
+ super().find_module(fullname, path)
- class Finder(abc.Finder):
+ class PathEntryFinder(abc.PathEntryFinder):
def find_module(self, _):
super().find_module(_)
def find_loader(self, _):
super().find_loader(_)
+ class Finder(abc.Finder):
+ def find_module(self, fullname, path):
+ super().find_module(fullname, path)
+
+ class Loader(abc.Loader):
+ def load_module(self, fullname):
+ super().load_module(fullname)
+ def module_repr(self, module):
+ super().module_repr(module)
+
class ResourceLoader(Loader, abc.ResourceLoader):
def get_data(self, _):
super().get_data(_)
diff --git a/Lib/test/test_importlib/test_abc.py b/Lib/test/test_importlib/test_abc.py
index 008bd21..90f38b8 100644
--- a/Lib/test/test_importlib/test_abc.py
+++ b/Lib/test/test_importlib/test_abc.py
@@ -30,11 +30,16 @@ class InheritanceTests:
"{0} is not a superclass of {1}".format(superclass, self.__test))
-class Finder(InheritanceTests, unittest.TestCase):
+class MetaPathFinder(InheritanceTests, unittest.TestCase):
+ superclasses = [abc.Finder]
subclasses = [machinery.BuiltinImporter, machinery.FrozenImporter,
machinery.PathFinder]
+class PathEntryFinder(InheritanceTests, unittest.TestCase):
+
+ superclasses = [abc.Finder]
+ subclasses = [machinery.FileFinder]
class Loader(InheritanceTests, unittest.TestCase):