diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2012-06-17 20:33:38 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2012-06-17 20:33:38 (GMT) |
commit | 48114b952b22cf68ab7dccfb571a2194fd89e6ef (patch) | |
tree | 092accea1abbecaddf80290dd092ed1b6f0dfc12 /Lib/test/test_import.py | |
parent | 7636b193661f19eb21d35437c9f022cc7fc80e9f (diff) | |
download | cpython-48114b952b22cf68ab7dccfb571a2194fd89e6ef.zip cpython-48114b952b22cf68ab7dccfb571a2194fd89e6ef.tar.gz cpython-48114b952b22cf68ab7dccfb571a2194fd89e6ef.tar.bz2 |
Issue #14657: The frozen instance of importlib used for bootstrap is now also the module imported as importlib._bootstrap.
Diffstat (limited to 'Lib/test/test_import.py')
-rw-r--r-- | Lib/test/test_import.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py index 01441ad..7ae690b 100644 --- a/Lib/test/test_import.py +++ b/Lib/test/test_import.py @@ -19,7 +19,7 @@ import test.support from test.support import ( EnvironmentVarGuard, TESTFN, check_warnings, forget, is_jython, make_legacy_pyc, rmtree, run_unittest, swap_attr, swap_item, temp_umask, - unlink, unload, create_empty_file) + unlink, unload, create_empty_file, cpython_only) from test import script_helper @@ -746,6 +746,23 @@ class TestSymbolicallyLinkedPackage(unittest.TestCase): sys.path[:] = self.orig_sys_path +@cpython_only +class ImportlibBootstrapTests(unittest.TestCase): + # These tests check that importlib is bootstrapped. + + def test_frozen_importlib(self): + mod = sys.modules['_frozen_importlib'] + self.assertTrue(mod) + + def test_frozen_importlib_is_bootstrap(self): + from importlib import _bootstrap + mod = sys.modules['_frozen_importlib'] + self.assertIs(mod, _bootstrap) + self.assertEqual(mod.__name__, 'importlib._bootstrap') + self.assertEqual(mod.__package__, 'importlib') + self.assertTrue(mod.__file__.endswith('_bootstrap.py'), mod.__file__) + + def test_main(verbose=None): flag = importlib_util.using___import__ try: @@ -753,6 +770,7 @@ def test_main(verbose=None): run_unittest(ImportTests, PycacheTests, PycRewritingTests, PathsTests, RelativeImportTests, OverridingImportBuiltinTests, + ImportlibBootstrapTests, TestSymbolicallyLinkedPackage, importlib_import_test_suite()) finally: |