diff options
Diffstat (limited to 'Lib/importlib/test')
-rw-r--r-- | Lib/importlib/test/extension/test_case_sensitivity.py | 4 | ||||
-rw-r--r-- | Lib/importlib/test/extension/test_finder.py | 4 | ||||
-rw-r--r-- | Lib/importlib/test/extension/test_loader.py | 6 | ||||
-rw-r--r-- | Lib/importlib/test/extension/test_path_hook.py | 4 | ||||
-rw-r--r-- | Lib/importlib/test/source/test_case_sensitivity.py | 4 | ||||
-rw-r--r-- | Lib/importlib/test/source/test_file_loader.py | 24 | ||||
-rw-r--r-- | Lib/importlib/test/source/test_finder.py | 4 | ||||
-rw-r--r-- | Lib/importlib/test/source/test_path_hook.py | 4 | ||||
-rw-r--r-- | Lib/importlib/test/source/test_source_encoding.py | 8 |
9 files changed, 34 insertions, 28 deletions
diff --git a/Lib/importlib/test/extension/test_case_sensitivity.py b/Lib/importlib/test/extension/test_case_sensitivity.py index 3387e70..2ccec89 100644 --- a/Lib/importlib/test/extension/test_case_sensitivity.py +++ b/Lib/importlib/test/extension/test_case_sensitivity.py @@ -1,7 +1,7 @@ import sys from test import support import unittest -import importlib +from importlib import _bootstrap from .. import util from . import util as ext_util @@ -13,7 +13,7 @@ class ExtensionModuleCaseSensitivityTest(unittest.TestCase): good_name = ext_util.NAME bad_name = good_name.upper() assert good_name != bad_name - finder = importlib.ExtensionFileFinder(ext_util.PATH) + finder = _bootstrap._ExtensionFileFinder(ext_util.PATH) return finder.find_module(bad_name) def test_case_sensitive(self): diff --git a/Lib/importlib/test/extension/test_finder.py b/Lib/importlib/test/extension/test_finder.py index 3fc9b0b..39e26a7 100644 --- a/Lib/importlib/test/extension/test_finder.py +++ b/Lib/importlib/test/extension/test_finder.py @@ -1,4 +1,4 @@ -import importlib +from importlib import _bootstrap from .. import abc from . import util @@ -9,7 +9,7 @@ class FinderTests(abc.FinderTests): """Test the finder for extension modules.""" def find_module(self, fullname): - importer = importlib.ExtensionFileFinder(util.PATH) + importer = _bootstrap._ExtensionFileFinder(util.PATH) return importer.find_module(fullname) def test_module(self): diff --git a/Lib/importlib/test/extension/test_loader.py b/Lib/importlib/test/extension/test_loader.py index f961a63..157a3b6 100644 --- a/Lib/importlib/test/extension/test_loader.py +++ b/Lib/importlib/test/extension/test_loader.py @@ -1,4 +1,4 @@ -import importlib +from importlib import _bootstrap from . import util as ext_util from .. import abc from .. import util @@ -12,7 +12,7 @@ class LoaderTests(abc.LoaderTests): """Test load_module() for extension modules.""" def load_module(self, fullname): - loader = importlib._ExtensionFileLoader(ext_util.NAME, + loader = _bootstrap._ExtensionFileLoader(ext_util.NAME, ext_util.FILEPATH, False) return loader.load_module(fullname) @@ -25,7 +25,7 @@ class LoaderTests(abc.LoaderTests): self.assertEqual(getattr(module, attr), value) self.assert_(ext_util.NAME in sys.modules) self.assert_(isinstance(module.__loader__, - importlib._ExtensionFileLoader)) + _bootstrap._ExtensionFileLoader)) def test_package(self): # Extensions are not found in packages. diff --git a/Lib/importlib/test/extension/test_path_hook.py b/Lib/importlib/test/extension/test_path_hook.py index 76f4995..8532956 100644 --- a/Lib/importlib/test/extension/test_path_hook.py +++ b/Lib/importlib/test/extension/test_path_hook.py @@ -1,4 +1,4 @@ -import importlib +from importlib import _bootstrap from . import util import collections @@ -14,7 +14,7 @@ class PathHookTests(unittest.TestCase): # XXX Should it only work for directories containing an extension module? def hook(self, entry): - return importlib.ExtensionFileFinder(entry) + return _bootstrap._ExtensionFileFinder(entry) def test_success(self): # Path hook should handle a directory where a known extension module diff --git a/Lib/importlib/test/source/test_case_sensitivity.py b/Lib/importlib/test/source/test_case_sensitivity.py index 210e620..368e893 100644 --- a/Lib/importlib/test/source/test_case_sensitivity.py +++ b/Lib/importlib/test/source/test_case_sensitivity.py @@ -1,5 +1,5 @@ """Test case-sensitivity (PEP 235).""" -import importlib +from importlib import _bootstrap from .. import util from . import util as source_util import os @@ -19,7 +19,7 @@ class CaseSensitivityTest(unittest.TestCase): assert name != name.lower() def find(self, path): - finder = importlib.PyPycFileFinder(path) + finder = _bootstrap._PyPycFileFinder(path) return finder.find_module(self.name) def sensitivity_test(self): diff --git a/Lib/importlib/test/source/test_file_loader.py b/Lib/importlib/test/source/test_file_loader.py index 3da4426..f3d75c3 100644 --- a/Lib/importlib/test/source/test_file_loader.py +++ b/Lib/importlib/test/source/test_file_loader.py @@ -1,4 +1,5 @@ import importlib +from importlib import _bootstrap from .. import abc from . import util as source_util @@ -19,7 +20,8 @@ class SimpleTest(unittest.TestCase): # [basic] def test_module(self): with source_util.create_modules('_temp') as mapping: - loader = importlib.PyPycFileLoader('_temp', mapping['_temp'], False) + loader = _bootstrap._PyPycFileLoader('_temp', mapping['_temp'], + False) module = loader.load_module('_temp') self.assert_('_temp' in sys.modules) check = {'__name__': '_temp', '__file__': mapping['_temp'], @@ -29,8 +31,9 @@ class SimpleTest(unittest.TestCase): def test_package(self): with source_util.create_modules('_pkg.__init__') as mapping: - loader = importlib.PyPycFileLoader('_pkg', mapping['_pkg.__init__'], - True) + loader = _bootstrap._PyPycFileLoader('_pkg', + mapping['_pkg.__init__'], + True) module = loader.load_module('_pkg') self.assert_('_pkg' in sys.modules) check = {'__name__': '_pkg', '__file__': mapping['_pkg.__init__'], @@ -42,8 +45,8 @@ class SimpleTest(unittest.TestCase): def test_lacking_parent(self): with source_util.create_modules('_pkg.__init__', '_pkg.mod')as mapping: - loader = importlib.PyPycFileLoader('_pkg.mod', mapping['_pkg.mod'], - False) + loader = _bootstrap._PyPycFileLoader('_pkg.mod', + mapping['_pkg.mod'], False) module = loader.load_module('_pkg.mod') self.assert_('_pkg.mod' in sys.modules) check = {'__name__': '_pkg.mod', '__file__': mapping['_pkg.mod'], @@ -57,7 +60,8 @@ class SimpleTest(unittest.TestCase): def test_module_reuse(self): with source_util.create_modules('_temp') as mapping: - loader = importlib.PyPycFileLoader('_temp', mapping['_temp'], False) + loader = _bootstrap._PyPycFileLoader('_temp', mapping['_temp'], + False) module = loader.load_module('_temp') module_id = id(module) module_dict_id = id(module.__dict__) @@ -87,7 +91,8 @@ class SimpleTest(unittest.TestCase): setattr(orig_module, attr, value) with open(mapping[name], 'w') as file: file.write('+++ bad syntax +++') - loader = importlib.PyPycFileLoader('_temp', mapping['_temp'], False) + loader = _bootstrap._PyPycFileLoader('_temp', mapping['_temp'], + False) self.assertRaises(SyntaxError, loader.load_module, name) for attr in attributes: self.assertEqual(getattr(orig_module, attr), value) @@ -97,7 +102,8 @@ class SimpleTest(unittest.TestCase): with source_util.create_modules('_temp') as mapping: with open(mapping['_temp'], 'w') as file: file.write('=') - loader = importlib.PyPycFileLoader('_temp', mapping['_temp'], False) + loader = _bootstrap._PyPycFileLoader('_temp', mapping['_temp'], + False) self.assertRaises(SyntaxError, loader.load_module, '_temp') self.assert_('_temp' not in sys.modules) @@ -116,7 +122,7 @@ class BadBytecodeTest(unittest.TestCase): """ def import_(self, file, module_name): - loader = importlib.PyPycFileLoader(module_name, file, False) + loader = _bootstrap._PyPycFileLoader(module_name, file, False) module = loader.load_module(module_name) self.assert_(module_name in sys.modules) diff --git a/Lib/importlib/test/source/test_finder.py b/Lib/importlib/test/source/test_finder.py index 1e4333c..dd56429 100644 --- a/Lib/importlib/test/source/test_finder.py +++ b/Lib/importlib/test/source/test_finder.py @@ -1,4 +1,4 @@ -import importlib +from importlib import _bootstrap from .. import abc from . import util as source_util import os @@ -32,7 +32,7 @@ class FinderTests(abc.FinderTests): """ def import_(self, root, module): - finder = importlib.PyPycFileFinder(root) + finder = _bootstrap._PyPycFileFinder(root) return finder.find_module(module) def run_test(self, test, create=None, *, compile_=None, unlink=None): diff --git a/Lib/importlib/test/source/test_path_hook.py b/Lib/importlib/test/source/test_path_hook.py index 9a4ccbe..71ca508 100644 --- a/Lib/importlib/test/source/test_path_hook.py +++ b/Lib/importlib/test/source/test_path_hook.py @@ -1,4 +1,4 @@ -import importlib +from importlib import _bootstrap from . import util as source_util import unittest @@ -10,7 +10,7 @@ class PathHookTest(unittest.TestCase): def test_success(self): # XXX Only work on existing directories? with source_util.create_modules('dummy') as mapping: - self.assert_(hasattr(importlib.FileFinder(mapping['.root']), + self.assert_(hasattr(_bootstrap._FileFinder(mapping['.root']), 'find_module')) diff --git a/Lib/importlib/test/source/test_source_encoding.py b/Lib/importlib/test/source/test_source_encoding.py index 9e9c7e8..3734712 100644 --- a/Lib/importlib/test/source/test_source_encoding.py +++ b/Lib/importlib/test/source/test_source_encoding.py @@ -1,4 +1,4 @@ -import importlib +from importlib import _bootstrap from . import util as source_util import codecs @@ -35,7 +35,7 @@ class EncodingTest(unittest.TestCase): with source_util.create_modules(self.module_name) as mapping: with open(mapping[self.module_name], 'wb')as file: file.write(source) - loader = importlib.PyPycFileLoader(self.module_name, + loader = _bootstrap._PyPycFileLoader(self.module_name, mapping[self.module_name], False) return loader.load_module(self.module_name) @@ -96,8 +96,8 @@ class LineEndingTest(unittest.TestCase): with source_util.create_modules(module_name) as mapping: with open(mapping[module_name], 'wb') as file: file.write(source) - loader = importlib.PyPycFileLoader(module_name, mapping[module_name], - False) + loader = _bootstrap._PyPycFileLoader(module_name, + mapping[module_name], False) return loader.load_module(module_name) # [cr] |