Skip to content

mypy output for submodule differs between invoking on package vs submodule #10956

Closed
@sanderr

Description

@sanderr

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.

  1. Clone the repo: git clone https://github.com/inmanta/inmanta-core.git
  2. Check out a commit on which the issue exists cd inmanta-core && git checkout a49f051a
  3. Create and activate a virtual env
  4. Install the project in the venv: make install
  5. Run mypy src/inmanta/ | grep "src/inmanta/module.py" and compare the output with mypy 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): in setup.cfg:
    [mypy]
    plugins = pydantic.mypy
    
  • Python version used: 3.9 and 3.6
  • Operating system and version: Arch Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions