summaryrefslogtreecommitdiff
path: root/Lib/test/test_importlib/source
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_importlib/source')
-rw-r--r--Lib/test/test_importlib/source/test_case_sensitivity.py1
-rw-r--r--Lib/test/test_importlib/source/test_file_loader.py9
-rw-r--r--Lib/test/test_importlib/source/test_path_hook.py11
-rw-r--r--Lib/test/test_importlib/source/test_source_encoding.py1
4 files changed, 12 insertions, 10 deletions
diff --git a/Lib/test/test_importlib/source/test_case_sensitivity.py b/Lib/test/test_importlib/source/test_case_sensitivity.py
index 34b86cddd1..12ce0cb934 100644
--- a/Lib/test/test_importlib/source/test_case_sensitivity.py
+++ b/Lib/test/test_importlib/source/test_case_sensitivity.py
@@ -5,7 +5,6 @@ importlib = util.import_importlib('importlib')
machinery = util.import_importlib('importlib.machinery')
import os
-import sys
from test import support as test_support
import unittest
diff --git a/Lib/test/test_importlib/source/test_file_loader.py b/Lib/test/test_importlib/source/test_file_loader.py
index 73f4c62070..a151149f31 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 e6a2415bda..795d436c3b 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'))
diff --git a/Lib/test/test_importlib/source/test_source_encoding.py b/Lib/test/test_importlib/source/test_source_encoding.py
index 1e0771b19d..980855fe1a 100644
--- a/Lib/test/test_importlib/source/test_source_encoding.py
+++ b/Lib/test/test_importlib/source/test_source_encoding.py
@@ -5,7 +5,6 @@ machinery = util.import_importlib('importlib.machinery')
import codecs
import importlib.util
import re
-import sys
import types
# Because sys.path gets essentially blanked, need to have unicodedata already
# imported for the parser to use.