Open
Description
Steps to reproduce
- Create module test.py with import from nonexistent module:
from foo import bar
- Create mypy.ini file:
[mypy]
[mypy-foo]
ignore_missing_imports = True
- Run
mypy
$ mypy test.py
Success: no issues found in 1 source file
- Comment out
[mypy-foo]
section in mypy.ini
[mypy]
# [mypy-foo]
# ignore_missing_imports = True
- Run
mypy
$ mypy test.py
Success: no issues found in 1 source file
Expected result
After step 4, mypy should detect config change and (partially?) invalidate cache, leading to a type error.
$ mypy test.py
test.py:1: error: Cannot find module named 'foo'
test.py:1: note: See https://mypy.readthedocs.io/en/latest/running_mypy.html#missing-imports
Found 1 error in 1 file (checked 1 source file)
Notes
- Deleting
.mypy_cache/
and re-runningmypy
fixes the issue. - Adding/removing
ignore_missing_imports
in the main[mypy]
section does seem to invalidate the cache as expected. So this issue only seems to apply to[mypy-PATTERN]
sections.
Versions
$ python --version
Python 3.7.3
$ mypy --version
mypy 0.740