summaryrefslogtreecommitdiffstats
path: root/Lib/importlib/test
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2012-04-14 18:10:13 (GMT)
committerBrett Cannon <brett@python.org>2012-04-14 18:10:13 (GMT)
commitfd0741555b733f66c0a35c698d0cac5e73010ae0 (patch)
tree739b3aeb0a9d31f49dd334e5f57b5376b20d7dc7 /Lib/importlib/test
parentd2cbd9053975d6d6a98adb23b2735b2125ed0626 (diff)
downloadcpython-fd0741555b733f66c0a35c698d0cac5e73010ae0.zip
cpython-fd0741555b733f66c0a35c698d0cac5e73010ae0.tar.gz
cpython-fd0741555b733f66c0a35c698d0cac5e73010ae0.tar.bz2
Issue #2377: Make importlib the implementation of __import__().
importlib._bootstrap is now frozen into Python/importlib.h and stored as _frozen_importlib in sys.modules. Py_Initialize() loads the frozen code along with sys and imp and then uses _frozen_importlib._install() to set builtins.__import__() w/ _frozen_importlib.__import__().
Diffstat (limited to 'Lib/importlib/test')
-rw-r--r--Lib/importlib/test/import_/test_path.py2
-rw-r--r--Lib/importlib/test/import_/util.py1
-rw-r--r--Lib/importlib/test/regrtest.py12
-rw-r--r--Lib/importlib/test/source/test_file_loader.py2
-rw-r--r--Lib/importlib/test/source/test_finder.py7
-rw-r--r--Lib/importlib/test/source/test_path_hook.py3
-rw-r--r--Lib/importlib/test/source/test_source_encoding.py4
-rw-r--r--Lib/importlib/test/util.py2
8 files changed, 11 insertions, 22 deletions
diff --git a/Lib/importlib/test/import_/test_path.py b/Lib/importlib/test/import_/test_path.py
index 5713319..a211bdf 100644
--- a/Lib/importlib/test/import_/test_path.py
+++ b/Lib/importlib/test/import_/test_path.py
@@ -87,7 +87,7 @@ class FinderTests(unittest.TestCase):
class DefaultPathFinderTests(unittest.TestCase):
- """Test importlib._bootstrap._DefaultPathFinder."""
+ """Test _bootstrap._DefaultPathFinder."""
def test_implicit_hooks(self):
# Test that the implicit path hooks are used.
diff --git a/Lib/importlib/test/import_/util.py b/Lib/importlib/test/import_/util.py
index 649c5ed..86ac065 100644
--- a/Lib/importlib/test/import_/util.py
+++ b/Lib/importlib/test/import_/util.py
@@ -1,6 +1,5 @@
import functools
import importlib
-import importlib._bootstrap
import unittest
diff --git a/Lib/importlib/test/regrtest.py b/Lib/importlib/test/regrtest.py
index dc0eb97..9cc9ee7 100644
--- a/Lib/importlib/test/regrtest.py
+++ b/Lib/importlib/test/regrtest.py
@@ -13,16 +13,4 @@ from test import regrtest
if __name__ == '__main__':
__builtins__.__import__ = importlib.__import__
- exclude = ['--exclude',
- 'test_frozen', # Does not expect __loader__ attribute
- 'test_pkg', # Does not expect __loader__ attribute
- 'test_pydoc', # Does not expect __loader__ attribute
- ]
-
- # Switching on --exclude implies running all test but the ones listed, so
- # only use it when one is not running an explicit test
- if len(sys.argv) == 1:
- # No programmatic way to specify tests to exclude
- sys.argv.extend(exclude)
-
regrtest.main(quiet=True, verbose2=True)
diff --git a/Lib/importlib/test/source/test_file_loader.py b/Lib/importlib/test/source/test_file_loader.py
index cb1c317..710339c 100644
--- a/Lib/importlib/test/source/test_file_loader.py
+++ b/Lib/importlib/test/source/test_file_loader.py
@@ -1,5 +1,5 @@
+from ... import _bootstrap
import importlib
-from importlib import _bootstrap
from .. import abc
from .. import util
from . import util as source_util
diff --git a/Lib/importlib/test/source/test_finder.py b/Lib/importlib/test/source/test_finder.py
index 68e9ae7..315aa77 100644
--- a/Lib/importlib/test/source/test_finder.py
+++ b/Lib/importlib/test/source/test_finder.py
@@ -1,10 +1,11 @@
-from importlib import _bootstrap
from .. import abc
from . import util as source_util
-from test.support import make_legacy_pyc
-import os
+
+from importlib import _bootstrap
import errno
+import os
import py_compile
+from test.support import make_legacy_pyc
import unittest
import warnings
diff --git a/Lib/importlib/test/source/test_path_hook.py b/Lib/importlib/test/source/test_path_hook.py
index 374f7b6..3de822c 100644
--- a/Lib/importlib/test/source/test_path_hook.py
+++ b/Lib/importlib/test/source/test_path_hook.py
@@ -1,5 +1,6 @@
-from importlib import _bootstrap
from . import util as source_util
+
+from importlib import _bootstrap
import unittest
diff --git a/Lib/importlib/test/source/test_source_encoding.py b/Lib/importlib/test/source/test_source_encoding.py
index 794a3df..72a1360 100644
--- a/Lib/importlib/test/source/test_source_encoding.py
+++ b/Lib/importlib/test/source/test_source_encoding.py
@@ -1,6 +1,6 @@
-from importlib import _bootstrap
from . import util as source_util
+from importlib import _bootstrap
import codecs
import re
import sys
@@ -36,7 +36,7 @@ class EncodingTest(unittest.TestCase):
with open(mapping[self.module_name], 'wb') as file:
file.write(source)
loader = _bootstrap._SourceFileLoader(self.module_name,
- mapping[self.module_name])
+ mapping[self.module_name])
return loader.load_module(self.module_name)
def create_source(self, encoding):
diff --git a/Lib/importlib/test/util.py b/Lib/importlib/test/util.py
index 93b7cd2..7ba7a97 100644
--- a/Lib/importlib/test/util.py
+++ b/Lib/importlib/test/util.py
@@ -35,7 +35,7 @@ def uncache(*names):
for name in names:
if name in ('sys', 'marshal', 'imp'):
raise ValueError(
- "cannot uncache {0} as it will break _importlib".format(name))
+ "cannot uncache {0}".format(name))
try:
del sys.modules[name]
except KeyError: