Fixes to stubtest's new check for missing stdlib modules by AlexWaygood · Pull Request #15960 · python/mypy (original) (raw)
I did a trial run with my typeshed fork using GitHub Actions to see what the results of running stubtest on typeshed's stdlib stubs were with mypy's master branch. It's a good job that I did, as it revealed that there were a few flaws in the logic I introduced in #15729:
- It's not easy to predict where stdlib modules are going to be located. (It varies between platforms, and between venvs and conda envs; on some platforms it's in a completely different directory to the Python executable.)
- Some modules appear to raise
SystemExit
when stubtest tries to import them in CI, leading stubtest to instantly exit without logging a message to the terminal. - Importing some
test.*
submodules leads to unraisable exceptions being printed to the terminal at the end of the stubtest run, which is somewhat annoying.
This PR fixes the bugs. This logic has now been tested locally using venv, locally using conda environments, on GitHub Actions, on py311, py38, Ubuntu, Windows and macOS.