Closed
Description
Bug Report
The 0.930 version of stubtest
doesn't seem to handle local/relative imports (from .local import thing
) that worked with 0.921.
To Reproduce
(VIRTUAL) ~/mypytest:python --version
Python 3.9.9
(VIRTUAL) ~/mypytest:tail -n +1 temp/* run_stubtest.py
==> temp/__init__.py <==
from .local import AN_INT
ANOTHER_INT = AN_INT
==> temp/__init__.pyi <==
ANOTHER_INT: int
==> temp/local.py <==
AN_INT = 1
==> temp/local.pyi <==
AN_INT: int
==> run_stubtest.py <==
import sys
from mypy import stubtest
if __name__ == "__main__":
sys.exit(stubtest.test_stubs(stubtest.parse_options(["temp"])))
(VIRTUAL) ~/mypytest:pip install mypy==0.921
<snip>
Successfully installed mypy-0.921
(VIRTUAL) ~/mypytest:python run_stubtest.py
(VIRTUAL) ~/mypytest:pip install mypy==0.930
<snip>
Successfully installed mypy-0.930
(VIRTUAL) ~/mypytest:python run_stubtest.py
error: temp.AN_INT is not present in stub
Stub:
MISSING
Runtime:
1
Expected Behavior
Expect the behaviour of 0.921 – stubtest passes:
(VIRTUAL) ~/mypytest:pip install mypy==0.921
<snip>
Successfully installed mypy-0.921
(VIRTUAL) ~/mypytest:python run_stubtest.py
Actual Behavior
stubtest
0.931 shows an error relating to the local import:
(VIRTUAL) ~/mypytest:pip install mypy==0.930
<snip>
Successfully installed mypy-0.930
(VIRTUAL) ~/mypytest:python run_stubtest.py
error: temp.AN_INT is not present in stub
Stub:
MISSING
Runtime:
1
Your Environment
- Mypy version used: 0.921 and 0.930
- Mypy command-line flags: N/A
- Mypy configuration options from
mypy.ini
(and other config files): None - Python version used: 3.9.9
- Operating system and version: MacOS 10.15.7