summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_importlib/import_
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/import_
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/import_')
-rw-r--r--Lib/test/test_importlib/import_/test___loader__.py6
-rw-r--r--Lib/test/test_importlib/import_/test_api.py5
-rw-r--r--Lib/test/test_importlib/import_/test_fromlist.py1
3 files changed, 6 insertions, 6 deletions
diff --git a/Lib/test/test_importlib/import_/test___loader__.py b/Lib/test/test_importlib/import_/test___loader__.py
index 3e0d3dd..535daa0 100644
--- a/Lib/test/test_importlib/import_/test___loader__.py
+++ b/Lib/test/test_importlib/import_/test___loader__.py
@@ -1,5 +1,5 @@
-import imp
import sys
+import types
import unittest
from .. import util
@@ -19,7 +19,7 @@ class LoaderMock:
class LoaderAttributeTests(unittest.TestCase):
def test___loader___missing(self):
- module = imp.new_module('blah')
+ module = types.ModuleType('blah')
try:
del module.__loader__
except AttributeError:
@@ -31,7 +31,7 @@ class LoaderAttributeTests(unittest.TestCase):
self.assertEqual(loader, module.__loader__)
def test___loader___is_None(self):
- module = imp.new_module('blah')
+ module = types.ModuleType('blah')
module.__loader__ = None
loader = LoaderMock()
loader.module = module
diff --git a/Lib/test/test_importlib/import_/test_api.py b/Lib/test/test_importlib/import_/test_api.py
index 4b7baad..98f79d6 100644
--- a/Lib/test/test_importlib/import_/test_api.py
+++ b/Lib/test/test_importlib/import_/test_api.py
@@ -2,6 +2,7 @@ from .. import util as importlib_test_util
from . import util
import imp
import sys
+import types
import unittest
@@ -48,7 +49,7 @@ class APITest(unittest.TestCase):
def test_nonexistent_fromlist_entry(self):
# If something in fromlist doesn't exist, that's okay.
# issue15715
- mod = imp.new_module('fine')
+ mod = types.ModuleType('fine')
mod.__path__ = ['XXX']
with importlib_test_util.import_state(meta_path=[BadLoaderFinder]):
with importlib_test_util.uncache('fine'):
@@ -59,7 +60,7 @@ class APITest(unittest.TestCase):
# If something in fromlist triggers an exception not related to not
# existing, let that exception propagate.
# issue15316
- mod = imp.new_module('fine')
+ mod = types.ModuleType('fine')
mod.__path__ = ['XXX']
with importlib_test_util.import_state(meta_path=[BadLoaderFinder]):
with importlib_test_util.uncache('fine'):
diff --git a/Lib/test/test_importlib/import_/test_fromlist.py b/Lib/test/test_importlib/import_/test_fromlist.py
index 9aa27a0..a31d216 100644
--- a/Lib/test/test_importlib/import_/test_fromlist.py
+++ b/Lib/test/test_importlib/import_/test_fromlist.py
@@ -1,7 +1,6 @@
"""Test that the semantics relating to the 'fromlist' argument are correct."""
from .. import util
from . import util as import_util
-import imp
import unittest
class ReturnValue(unittest.TestCase):