Description
Bug Report
Running mypy against a whole package doesn't always give the same output for one of its modules as running it against that module directly. Specifically some errors are omitted when run against the whole package. #10260 seems to describe a related discrepancy, though the behavior there is more or less the opposite to this one (additionally, it is for a version of mypy that doesn't produce this issue).
To Reproduce
Alas I didn't manage to find a simple reproductive example. Instead I'll have to refer to the project where I encountered the issue.
- Clone the repo:
git clone https://github.com/inmanta/inmanta-core.git
- Check out a commit on which the issue exists
cd inmanta-core && git checkout a49f051a
- Create and activate a virtual env
- Install the project in the venv:
make install
- Run
mypy src/inmanta/ | grep "src/inmanta/module.py"
and compare the output withmypy src/inmanta/module.py
.
Expected Behavior
The src/inmanta/module.py
file contains type errors, as shown by mypy src/inmanta/module.py
. I would expect to see the same errors for the same file, regardless of how it was invoked. Specifically, in this case I would expect mypy src/inmanta/
to detect and report on all type errors in src/inmanta/module.py
.
Actual Behavior
The output of mypy src/inmanta/
only shows a subset of the errors for src/inmanta/module.py
that are shown in mypy src/inmanta/module.py
.
Your Environment
- Mypy version used: v0.900 - v0.910 (v0.812 works as expected)
- Mypy command-line flags:
mypy src/inmanta
/mypy src/inmanta/module.py
- Mypy configuration options from
mypy.ini
(and other config files): insetup.cfg
:[mypy] plugins = pydantic.mypy
- Python version used: 3.9 and 3.6
- Operating system and version: Arch Linux