Coverage not working with mypy ignores and vague errors
未关闭
还没有人认领这个 Issue。
bug
topic-error-reporting
- 主要语言
- Python
- 星标
- 20.6k
- 派生
- 3.3k
- PR 合并指标
- PR 指标待抓取
描述
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
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先,使用提供的 Python 代码片段和列出的 mypy 命令行标志复现报告,然后比较正常的 mypy 结果与 coverage 结果。该 issue 没有指定实现文件或测试,因此请先找到 coverage 入口点和现有的 coverage 测试,再继续进行。当 mypy 与 coverage 对被忽略的 import 和未使用的 ignore 的处理保持一致时,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- testing-qa
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 25/100