|
19 | 19 | from test.support import ( |
20 | 20 | EnvironmentVarGuard, TESTFN, check_warnings, forget, is_jython, |
21 | 21 | make_legacy_pyc, rmtree, run_unittest, swap_attr, swap_item, temp_umask, |
22 | | - unlink, unload, create_empty_file) |
| 22 | + unlink, unload, create_empty_file, cpython_only) |
23 | 23 | from test import script_helper |
24 | 24 |
|
25 | 25 |
|
@@ -746,13 +746,31 @@ def tearDown(self): |
746 | 746 | sys.path[:] = self.orig_sys_path |
747 | 747 |
|
748 | 748 |
|
| 749 | +@cpython_only |
| 750 | +class ImportlibBootstrapTests(unittest.TestCase): |
| 751 | + # These tests check that importlib is bootstrapped. |
| 752 | + |
| 753 | + def test_frozen_importlib(self): |
| 754 | + mod = sys.modules['_frozen_importlib'] |
| 755 | + self.assertTrue(mod) |
| 756 | + |
| 757 | + def test_frozen_importlib_is_bootstrap(self): |
| 758 | + from importlib import _bootstrap |
| 759 | + mod = sys.modules['_frozen_importlib'] |
| 760 | + self.assertIs(mod, _bootstrap) |
| 761 | + self.assertEqual(mod.__name__, 'importlib._bootstrap') |
| 762 | + self.assertEqual(mod.__package__, 'importlib') |
| 763 | + self.assertTrue(mod.__file__.endswith('_bootstrap.py'), mod.__file__) |
| 764 | + |
| 765 | + |
749 | 766 | def test_main(verbose=None): |
750 | 767 | flag = importlib_util.using___import__ |
751 | 768 | try: |
752 | 769 | importlib_util.using___import__ = True |
753 | 770 | run_unittest(ImportTests, PycacheTests, |
754 | 771 | PycRewritingTests, PathsTests, RelativeImportTests, |
755 | 772 | OverridingImportBuiltinTests, |
| 773 | + ImportlibBootstrapTests, |
756 | 774 | TestSymbolicallyLinkedPackage, |
757 | 775 | importlib_import_test_suite()) |
758 | 776 | finally: |
|
0 commit comments