summaryrefslogtreecommitdiffstats
path: root/Lib/importlib/test/extension/test_loader.py
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2009-02-07 02:06:43 (GMT)
committerBrett Cannon <bcannon@gmail.com>2009-02-07 02:06:43 (GMT)
commit534b2cd176a0440b59980d97723e109638216c1c (patch)
treeff57b132a27c308633c8a2f331650d1e50af2d15 /Lib/importlib/test/extension/test_loader.py
parent36d1f3eb41a5903d11076e72080bb1971b6818bb (diff)
downloadcpython-534b2cd176a0440b59980d97723e109638216c1c.zip
cpython-534b2cd176a0440b59980d97723e109638216c1c.tar.gz
cpython-534b2cd176a0440b59980d97723e109638216c1c.tar.bz2
Factor out helper code from importlib.test.extension.test_path_hook.
Diffstat (limited to 'Lib/importlib/test/extension/test_loader.py')
-rw-r--r--Lib/importlib/test/extension/test_loader.py23
1 files changed, 11 insertions, 12 deletions
diff --git a/Lib/importlib/test/extension/test_loader.py b/Lib/importlib/test/extension/test_loader.py
index 01f3426..ca9f2a7 100644
--- a/Lib/importlib/test/extension/test_loader.py
+++ b/Lib/importlib/test/extension/test_loader.py
@@ -1,5 +1,5 @@
import importlib
-from . import test_path_hook
+from . import util as ext_util
from .. import abc
from .. import util
@@ -12,19 +12,18 @@ class LoaderTests(abc.LoaderTests):
"""Test load_module() for extension modules."""
def load_module(self, fullname):
- loader = importlib._ExtensionFileLoader(test_path_hook.NAME,
- test_path_hook.FILEPATH,
- False)
+ loader = importlib._ExtensionFileLoader(ext_util.NAME,
+ ext_util.FILEPATH, False)
return loader.load_module(fullname)
def test_module(self):
- with util.uncache(test_path_hook.NAME):
- module = self.load_module(test_path_hook.NAME)
- for attr, value in [('__name__', test_path_hook.NAME),
- ('__file__', test_path_hook.FILEPATH),
+ with util.uncache(ext_util.NAME):
+ module = self.load_module(ext_util.NAME)
+ for attr, value in [('__name__', ext_util.NAME),
+ ('__file__', ext_util.FILEPATH),
('__package__', '')]:
self.assertEqual(getattr(module, attr), value)
- self.assert_(test_path_hook.NAME in sys.modules)
+ self.assert_(ext_util.NAME in sys.modules)
def test_package(self):
# Extensions are not found in packages.
@@ -35,9 +34,9 @@ class LoaderTests(abc.LoaderTests):
pass
def test_module_reuse(self):
- with util.uncache(test_path_hook.NAME):
- module1 = self.load_module(test_path_hook.NAME)
- module2 = self.load_module(test_path_hook.NAME)
+ with util.uncache(ext_util.NAME):
+ module1 = self.load_module(ext_util.NAME)
+ module2 = self.load_module(ext_util.NAME)
self.assert_(module1 is module2)
def test_state_after_failure(self):