Closed as not planned
Description
Bug Report
If the first 2 entries of sys.path
are pwd, mypy
seems to miss type checks in imported modules.
To Reproduce
mypy==0.971
# sscce.py
import sys
import mypy.api
sys.path.insert(0, sys.path[0])
print(mypy.api.run(["good.py"])[0])
# good.py
import bad
# bad.py
foo: str = 5
Expected Behavior
bad.py:1: error: Incompatible types in assignment (expression has type "int", variable has type "str")
Found 1 error in 1 file (checked 1 source file)
Actual Behavior
Success: no issues found in 1 source file
Your Environment
- Mypy version used: 0.971
This issue broke pytest-mypy
tests which use pytester.runpytest_subprocess
to run pytest
in a subprocess (see realpython/pytest-mypy#139).