summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_importlib/test_api.py
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2013-06-15 22:39:21 (GMT)
committerBrett Cannon <brett@python.org>2013-06-15 22:39:21 (GMT)
commitef888024d86eccb29b10d55066fa33c3aa54a586 (patch)
tree4c0c1bc6f81312987817d9a3d8358d4d16f9f330 /Lib/test/test_importlib/test_api.py
parent53e600c24a9a7159d5396432e1228b3dbd80eb19 (diff)
downloadcpython-ef888024d86eccb29b10d55066fa33c3aa54a586.zip
cpython-ef888024d86eccb29b10d55066fa33c3aa54a586.tar.gz
cpython-ef888024d86eccb29b10d55066fa33c3aa54a586.tar.bz2
Issue #17177: stop using imp in test_importlib
Diffstat (limited to 'Lib/test/test_importlib/test_api.py')
-rw-r--r--Lib/test/test_importlib/test_api.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/Lib/test/test_importlib/test_api.py b/Lib/test/test_importlib/test_api.py
index 330c04e..3a28cb7 100644
--- a/Lib/test/test_importlib/test_api.py
+++ b/Lib/test/test_importlib/test_api.py
@@ -1,5 +1,5 @@
from . import util
-import imp
+
import importlib
from importlib import _bootstrap
from importlib import machinery
@@ -99,7 +99,7 @@ class FindLoaderTests(unittest.TestCase):
# If a module with __loader__ is in sys.modules, then return it.
name = 'some_mod'
with util.uncache(name):
- module = imp.new_module(name)
+ module = types.ModuleType(name)
loader = 'a loader!'
module.__loader__ = loader
sys.modules[name] = module
@@ -110,7 +110,7 @@ class FindLoaderTests(unittest.TestCase):
# If sys.modules[name].__loader__ is None, raise ValueError.
name = 'some_mod'
with util.uncache(name):
- module = imp.new_module(name)
+ module = types.ModuleType(name)
module.__loader__ = None
sys.modules[name] = module
with self.assertRaises(ValueError):
@@ -121,7 +121,7 @@ class FindLoaderTests(unittest.TestCase):
# Issue #17099
name = 'some_mod'
with util.uncache(name):
- module = imp.new_module(name)
+ module = types.ModuleType(name)
try:
del module.__loader__
except AttributeError:
@@ -189,7 +189,7 @@ class InvalidateCacheTests(unittest.TestCase):
def test_method_lacking(self):
# There should be no issues if the method is not defined.
key = 'gobbledeegook'
- sys.path_importer_cache[key] = imp.NullImporter('abc')
+ sys.path_importer_cache[key] = None
self.addCleanup(lambda: sys.path_importer_cache.__delitem__(key))
importlib.invalidate_caches() # Shouldn't trigger an exception.