aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/importlib/test
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2009-02-21 03:15:37 +0000
committerBrett Cannon <bcannon@gmail.com>2009-02-21 03:15:37 +0000
commit2dee597e0593a8f7b477f58afe5e46f94b994541 (patch)
treeb3ddcc23c894a377ff78502209998aeae4f37dc7 /Lib/importlib/test
parenta2fcb1d964af0a0aa5cecb7e37f8abe7d0a1f867 (diff)
downloadcpython-2dee597e0593a8f7b477f58afe5e46f94b994541.tar.gz
cpython-2dee597e0593a8f7b477f58afe5e46f94b994541.zip
Do some cleanup in importlib:
+ Ditch using arguments to super(). + Ditch subclassing from object directly. + Move directory check out of chaining path hook to file path hook/finder. + Rename some classes to better reflect they are finders, not importers.
Diffstat (limited to 'Lib/importlib/test')
-rw-r--r--Lib/importlib/test/extension/test_case_sensitivity.py2
-rw-r--r--Lib/importlib/test/extension/test_finder.py2
-rw-r--r--Lib/importlib/test/extension/test_path_hook.py2
-rw-r--r--Lib/importlib/test/import_/test_path.py6
-rw-r--r--Lib/importlib/test/source/test_case_sensitivity.py2
-rw-r--r--Lib/importlib/test/source/test_finder.py2
-rw-r--r--Lib/importlib/test/source/test_path_hook.py2
7 files changed, 9 insertions, 9 deletions
diff --git a/Lib/importlib/test/extension/test_case_sensitivity.py b/Lib/importlib/test/extension/test_case_sensitivity.py
index eb05ad3b9a7..39e6facc990 100644
--- a/Lib/importlib/test/extension/test_case_sensitivity.py
+++ b/Lib/importlib/test/extension/test_case_sensitivity.py
@@ -13,7 +13,7 @@ class ExtensionModuleCaseSensitivityTest(unittest.TestCase):
good_name = ext_util.NAME
bad_name = good_name.upper()
assert good_name != bad_name
- finder = importlib.ExtensionFileImporter(ext_util.PATH)
+ finder = importlib.ExtensionFileFinder(ext_util.PATH)
return finder.find_module(bad_name)
def test_case_sensitive(self):
diff --git a/Lib/importlib/test/extension/test_finder.py b/Lib/importlib/test/extension/test_finder.py
index 7321e312bb5..3fc9b0b77e0 100644
--- a/Lib/importlib/test/extension/test_finder.py
+++ b/Lib/importlib/test/extension/test_finder.py
@@ -9,7 +9,7 @@ class FinderTests(abc.FinderTests):
"""Test the finder for extension modules."""
def find_module(self, fullname):
- importer = importlib.ExtensionFileImporter(util.PATH)
+ importer = importlib.ExtensionFileFinder(util.PATH)
return importer.find_module(fullname)
def test_module(self):
diff --git a/Lib/importlib/test/extension/test_path_hook.py b/Lib/importlib/test/extension/test_path_hook.py
index 674fd903170..76f4995ad8f 100644
--- a/Lib/importlib/test/extension/test_path_hook.py
+++ b/Lib/importlib/test/extension/test_path_hook.py
@@ -14,7 +14,7 @@ class PathHookTests(unittest.TestCase):
# XXX Should it only work for directories containing an extension module?
def hook(self, entry):
- return importlib.ExtensionFileImporter(entry)
+ return importlib.ExtensionFileFinder(entry)
def test_success(self):
# Path hook should handle a directory where a known extension module
diff --git a/Lib/importlib/test/import_/test_path.py b/Lib/importlib/test/import_/test_path.py
index 8cf5699764c..3d9b1a1ccd8 100644
--- a/Lib/importlib/test/import_/test_path.py
+++ b/Lib/importlib/test/import_/test_path.py
@@ -87,16 +87,16 @@ class DefaultPathFinderTests(unittest.TestCase):
importer = util.mock_modules(module)
path = '<test path>'
# XXX Not blackbox.
- original_hook = _bootstrap._DefaultPathFinder._default_hook
+ original_hook = _bootstrap._DEFAULT_PATH_HOOK
mock_hook = import_util.mock_path_hook(path, importer=importer)
- _bootstrap._DefaultPathFinder._default_hook = staticmethod(mock_hook)
+ _bootstrap._DEFAULT_PATH_HOOK = mock_hook
try:
with util.import_state(path_importer_cache={path: None}):
loader = _bootstrap._DefaultPathFinder.find_module(module,
path=[path])
self.assert_(loader is importer)
finally:
- _bootstrap._DefaultPathFinder._default_hook = original_hook
+ _bootstrap._DEFAULT_PATH_HOOK = original_hook
def test_main():
diff --git a/Lib/importlib/test/source/test_case_sensitivity.py b/Lib/importlib/test/source/test_case_sensitivity.py
index 6bd86cfcd9c..df6d3bcff6e 100644
--- a/Lib/importlib/test/source/test_case_sensitivity.py
+++ b/Lib/importlib/test/source/test_case_sensitivity.py
@@ -19,7 +19,7 @@ class CaseSensitivityTest(unittest.TestCase):
assert name != name.lower()
def find(self, path):
- finder = importlib.PyFileImporter(path)
+ finder = importlib.PyFileFinder(path)
return finder.find_module(self.name)
def sensitivity_test(self):
diff --git a/Lib/importlib/test/source/test_finder.py b/Lib/importlib/test/source/test_finder.py
index 0f1f549baa7..0cfb14f3e19 100644
--- a/Lib/importlib/test/source/test_finder.py
+++ b/Lib/importlib/test/source/test_finder.py
@@ -32,7 +32,7 @@ class FinderTests(abc.FinderTests):
"""
def import_(self, root, module):
- finder = importlib.PyFileImporter(root)
+ finder = importlib.PyFileFinder(root)
return finder.find_module(module)
def run_test(self, test, create=None, *, compile_=None, unlink=None):
diff --git a/Lib/importlib/test/source/test_path_hook.py b/Lib/importlib/test/source/test_path_hook.py
index 5aac42e5ff9..9a4ccbe3d78 100644
--- a/Lib/importlib/test/source/test_path_hook.py
+++ b/Lib/importlib/test/source/test_path_hook.py
@@ -10,7 +10,7 @@ class PathHookTest(unittest.TestCase):
def test_success(self):
# XXX Only work on existing directories?
with source_util.create_modules('dummy') as mapping:
- self.assert_(hasattr(importlib.FileImporter(mapping['.root']),
+ self.assert_(hasattr(importlib.FileFinder(mapping['.root']),
'find_module'))