summaryrefslogtreecommitdiff
path: root/Lib/test/test_importlib/source/test_finder.py
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2014-05-09 14:32:57 -0400
committerBrett Cannon <brett@python.org>2014-05-09 14:32:57 -0400
commit732ac654c8a3e5f9048a53efaee7380e1775a630 (patch)
tree29f2569faa5c7c968c3201b8074dc32f6fe06d5f /Lib/test/test_importlib/source/test_finder.py
parent91795c8e34cdae5616b4dd56fe616476dfdc1267 (diff)
downloadcpython-git-732ac654c8a3e5f9048a53efaee7380e1775a630.tar.gz
Issue #19721: Consolidate test_importlib utility code into a single
module.
Diffstat (limited to 'Lib/test/test_importlib/source/test_finder.py')
-rw-r--r--Lib/test/test_importlib/source/test_finder.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/Lib/test/test_importlib/source/test_finder.py b/Lib/test/test_importlib/source/test_finder.py
index 473297bdc8..dbf422d1fb 100644
--- a/Lib/test/test_importlib/source/test_finder.py
+++ b/Lib/test/test_importlib/source/test_finder.py
@@ -1,6 +1,5 @@
from .. import abc
from .. import util
-from . import util as source_util
machinery = util.import_importlib('importlib.machinery')
@@ -60,7 +59,7 @@ class FinderTests(abc.FinderTests):
"""
if create is None:
create = {test}
- with source_util.create_modules(*create) as mapping:
+ with util.create_modules(*create) as mapping:
if compile_:
for name in compile_:
py_compile.compile(mapping[name])
@@ -100,14 +99,14 @@ class FinderTests(abc.FinderTests):
# [sub module]
def test_module_in_package(self):
- with source_util.create_modules('pkg.__init__', 'pkg.sub') as mapping:
+ with util.create_modules('pkg.__init__', 'pkg.sub') as mapping:
pkg_dir = os.path.dirname(mapping['pkg.__init__'])
loader = self.import_(pkg_dir, 'pkg.sub')
self.assertTrue(hasattr(loader, 'load_module'))
# [sub package]
def test_package_in_package(self):
- context = source_util.create_modules('pkg.__init__', 'pkg.sub.__init__')
+ context = util.create_modules('pkg.__init__', 'pkg.sub.__init__')
with context as mapping:
pkg_dir = os.path.dirname(mapping['pkg.__init__'])
loader = self.import_(pkg_dir, 'pkg.sub')
@@ -120,7 +119,7 @@ class FinderTests(abc.FinderTests):
self.assertIn('__init__', loader.get_filename(name))
def test_failure(self):
- with source_util.create_modules('blah') as mapping:
+ with util.create_modules('blah') as mapping:
nothing = self.import_(mapping['.root'], 'sdfsadsadf')
self.assertIsNone(nothing)
@@ -147,7 +146,7 @@ class FinderTests(abc.FinderTests):
# Regression test for http://bugs.python.org/issue14846
def test_dir_removal_handling(self):
mod = 'mod'
- with source_util.create_modules(mod) as mapping:
+ with util.create_modules(mod) as mapping:
finder = self.get_finder(mapping['.root'])
found = self._find(finder, 'mod', loader_only=True)
self.assertIsNotNone(found)