summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_importlib
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2013-02-01 19:43:59 (GMT)
committerBrett Cannon <brett@python.org>2013-02-01 19:43:59 (GMT)
commite7387b470876e6f3a2f4b45ed47a7a061c9fdc99 (patch)
tree6e0e4bfc8adb4f149948b45bda6ec6ba70be8353 /Lib/test/test_importlib
parent0ecd30b4af4f5bd3c9e884a608e0a256ffe8f5fa (diff)
downloadcpython-e7387b470876e6f3a2f4b45ed47a7a061c9fdc99.zip
cpython-e7387b470876e6f3a2f4b45ed47a7a061c9fdc99.tar.gz
cpython-e7387b470876e6f3a2f4b45ed47a7a061c9fdc99.tar.bz2
Add a test for fix of issue #17098
Diffstat (limited to 'Lib/test/test_importlib')
-rw-r--r--Lib/test/test_importlib/test_api.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/Lib/test/test_importlib/test_api.py b/Lib/test/test_importlib/test_api.py
index ef6629a..3c3ba89 100644
--- a/Lib/test/test_importlib/test_api.py
+++ b/Lib/test/test_importlib/test_api.py
@@ -4,6 +4,7 @@ import importlib
from importlib import machinery
import sys
from test import support
+import types
import unittest
@@ -175,12 +176,22 @@ class FrozenImportlibTests(unittest.TestCase):
machinery.FrozenImporter))
+class StartupTests(unittest.TestCase):
+
+ def test_everyone_has___loader__(self):
+ # Issue #17098: all modules should have __loader__ defined.
+ for name, module in sys.modules.items():
+ if isinstance(module, types.ModuleType):
+ self.assertTrue(hasattr(module, '__loader__'),
+ '{!r} lacks a __loader__ attribute'.format(name))
+
def test_main():
from test.support import run_unittest
run_unittest(ImportModuleTests,
FindLoaderTests,
InvalidateCacheTests,
- FrozenImportlibTests)
+ FrozenImportlibTests,
+ StartupTests)
if __name__ == '__main__':