summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_importlib/test_api.py
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2013-02-01 20:31:49 (GMT)
committerBrett Cannon <brett@python.org>2013-02-01 20:31:49 (GMT)
commitda9cf0eef8c9cb338ad71330345423c9de2e0a01 (patch)
tree6308525f9a2e565f482746c6b399e808773bef73 /Lib/test/test_importlib/test_api.py
parente7387b470876e6f3a2f4b45ed47a7a061c9fdc99 (diff)
downloadcpython-da9cf0eef8c9cb338ad71330345423c9de2e0a01.zip
cpython-da9cf0eef8c9cb338ad71330345423c9de2e0a01.tar.gz
cpython-da9cf0eef8c9cb338ad71330345423c9de2e0a01.tar.bz2
Issue #17098: Be more stringent of setting __loader__ on early imported
modules. Also made test more rigorous.
Diffstat (limited to 'Lib/test/test_importlib/test_api.py')
-rw-r--r--Lib/test/test_importlib/test_api.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_importlib/test_api.py b/Lib/test/test_importlib/test_api.py
index 3c3ba89..5d63d85 100644
--- a/Lib/test/test_importlib/test_api.py
+++ b/Lib/test/test_importlib/test_api.py
@@ -184,6 +184,12 @@ class StartupTests(unittest.TestCase):
if isinstance(module, types.ModuleType):
self.assertTrue(hasattr(module, '__loader__'),
'{!r} lacks a __loader__ attribute'.format(name))
+ if name in sys.builtin_module_names:
+ self.assertEqual(importlib.machinery.BuiltinImporter,
+ module.__loader__)
+ elif imp.is_frozen(name):
+ self.assertEqual(importlib.machinery.FrozenImporter,
+ module.__loader__)
def test_main():
from test.support import run_unittest