Skip to content

Commit 404d27a

Browse files
author
hauntsaninja
committed
stubtest: import submodules mentioned in __all__
This kind of helps resolve python#9935
1 parent b535072 commit 404d27a

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎mypy/stubtest.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ def test_module(module_name: str) -> Iterator[Error]:
171171
with warnings.catch_warnings():
172172
warnings.simplefilter("ignore")
173173
runtime = importlib.import_module(module_name)
174+
# Also run the equivalent of `from module import *`
175+
# This could have the additional effect of loading not-yet-loaded submodules
176+
# mentioned in __all__
177+
__import__(module_name, fromlist=["*"])
174178
except Exception as e:
175179
yield Error([module_name], "failed to import: {}".format(e), stub, MISSING)
176180
return

0 commit comments

Comments
 (0)