summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_importlib/source
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2016-05-10 22:21:03 (GMT)
committerEric Snow <ericsnowcurrently@gmail.com>2016-05-10 22:21:03 (GMT)
commit228ab1ff6b5b02d8325a678b8afc140a153d4cf5 (patch)
tree416073624d9b0c50297ec609419fcd56f2a413e8 /Lib/test/test_importlib/source
parent3fa86a0612cd5d427aa36794822047fc58757b2e (diff)
downloadcpython-228ab1ff6b5b02d8325a678b8afc140a153d4cf5.zip
cpython-228ab1ff6b5b02d8325a678b8afc140a153d4cf5.tar.gz
cpython-228ab1ff6b5b02d8325a678b8afc140a153d4cf5.tar.bz2
Issue #21099: Switch applicable importlib tests to use PEP 451 API.
Diffstat (limited to 'Lib/test/test_importlib/source')
-rw-r--r--Lib/test/test_importlib/source/test_file_loader.py9
-rw-r--r--Lib/test/test_importlib/source/test_path_hook.py11
2 files changed, 12 insertions, 8 deletions
diff --git a/Lib/test/test_importlib/source/test_file_loader.py b/Lib/test/test_importlib/source/test_file_loader.py
index 73f4c62..a151149 100644
--- a/Lib/test/test_importlib/source/test_file_loader.py
+++ b/Lib/test/test_importlib/source/test_file_loader.py
@@ -217,7 +217,7 @@ class SimpleTest(abc.LoaderTests):
# PEP 302
with warnings.catch_warnings():
warnings.simplefilter('ignore', DeprecationWarning)
- mod = loader.load_module('_temp') # XXX
+ mod = loader.load_module('_temp')
# Sanity checks.
self.assertEqual(mod.__cached__, compiled)
self.assertEqual(mod.x, 5)
@@ -245,12 +245,7 @@ class SimpleTest(abc.LoaderTests):
class BadBytecodeTest:
def import_(self, file, module_name):
- loader = self.loader(module_name, file)
- with warnings.catch_warnings():
- warnings.simplefilter('ignore', DeprecationWarning)
- # XXX Change to use exec_module().
- module = loader.load_module(module_name)
- self.assertIn(module_name, sys.modules)
+ raise NotImplementedError
def manipulate_bytecode(self, name, mapping, manipulator, *,
del_source=False):
diff --git a/Lib/test/test_importlib/source/test_path_hook.py b/Lib/test/test_importlib/source/test_path_hook.py
index e6a2415..795d436 100644
--- a/Lib/test/test_importlib/source/test_path_hook.py
+++ b/Lib/test/test_importlib/source/test_path_hook.py
@@ -16,10 +16,19 @@ class PathHookTest:
def test_success(self):
with util.create_modules('dummy') as mapping:
self.assertTrue(hasattr(self.path_hook()(mapping['.root']),
- 'find_module'))
+ 'find_spec'))
+
+ def test_success_legacy(self):
+ with util.create_modules('dummy') as mapping:
+ self.assertTrue(hasattr(self.path_hook()(mapping['.root']),
+ 'find_module'))
def test_empty_string(self):
# The empty string represents the cwd.
+ self.assertTrue(hasattr(self.path_hook()(''), 'find_spec'))
+
+ def test_empty_string_legacy(self):
+ # The empty string represents the cwd.
self.assertTrue(hasattr(self.path_hook()(''), 'find_module'))