Coverage not working with mypy ignores and vague errors
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
Bug Report
(A clear and concise description of what the bug is.)
Coverage not showing the same result as mypy
To Reproduce
class A(BaseModel):
b: str = Field(default=..., description="some var")
Expected Behavior
To get the code coverage based on what I get with the mypy src call
Actual Behavior
I'm getting low coverage despite mypy not complaining after these ignores
Ignore missing imports and no warn unused ignores just doesnt apply to coverage, it shows passed when using mypy src but fails on coverage
Your Environment
- Mypy version used: latest
- Mypy command-line flags: mypy
--disallow-untyped-calls
--disallow-untyped-defs
--check-untyped-defs
--follow-imports=normal
--explicit-package-bases
--allow-untyped-globals
--ignore-missing-imports
--no-warn-unused-ignores
--warn-return-any
. - Mypy configuration options from
mypy.ini(and other config files): - Python version used: 3.13.2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the report with the provided Python snippet and the listed mypy command-line flags, then compare the normal mypy result with the coverage result. The issue does not name an implementation file or test, so locate the coverage entry point and existing coverage tests before proceeding. Done means the handling of ignored imports and unused ignores is consistent between mypy and coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100