Commit e7387b47 authored by Brett Cannon's avatar Brett Cannon

Add a test for fix of issue #17098

parent 0ecd30b4
......@@ -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__':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment