[BUG] XML generated from coverage.py `.coverage` doesn’t respect config
@thomasrockhu-codecov 已经在做这个了。
开始于 2025年2月26日。
评估
这个 Issue 还没有评估数据。
描述
Describe the bug
In my project, I configured coverage.py using pyproject.toml to
- write all files into a
test-filesfolder (idk if that’s relevant) - skip coverage for
if TYPE_CHECKING:blocks
The reported coverage reflects that (see table below), and when I run coverage xml, the test-files/coverage.xml file is also correct.
------------------------------------------------------------------ TOTAL 110 5 95%Name Stmts Miss Cover
------------------------------------------------------------------ src/fast_array_utils/__init__.py 4 0 100% src/fast_array_utils/_patches.py 2 0 100% src/fast_array_utils/conv/__init__.py 3 0 100% src/fast_array_utils/conv/_asarray.py 25 3 88% src/fast_array_utils/conv/scipy/__init__.py 3 0 100% src/fast_array_utils/conv/scipy/_to_dense.py 12 0 100% src/fast_array_utils/stats/__init__.py 3 0 100% src/fast_array_utils/stats/_sum.py 33 0 100% src/fast_array_utils/types.py 25 2 92%
But when the codecov CLI runs coverage xml via its coveragepy plugin, the lines are not skipped and codecov reports a 82.87% coverage instead of the expected 95.45% (see codecov report for the linked run below)
See also Additional context below for a workaround I’m using
To Reproduce
- set coverage.py’s
report.exclude_alsosetting in a pyproject.toml to ignore some lines - collect coverage in
.coveragefile and runcoverage xml - run codecov CLI’s upload (which will re-generate the XML)
- compare the XML you created with the one codecov’s CLI created
Expected behavior
either
coverage xmlrun from the codecov CLI uses the same config as when I run it, or- when the file passed via
--filealready exists, have the codecov CLI skip runningcoverage xml
Regression
This probably worked using the old coverage PyPI package, but IDK.
Screenshots
NA
Product Area
coverage
Versions
- OS: linux
- Git Host: GitHub
- CI/CD: GitHub Actions
- Uploader: [email protected], [email protected]
Commit and CI link
scverse/fast-array-utils@13436951846
https://github.com/scverse/fast-array-utils/actions/runs/13436951846/job/37541444988
Additional context
I can manually work around this by generating the XML myself and then deleting the test-files/.coverage file, but this should be fixed on your side.
See https://github.com/scverse/fast-array-utils/pull/29 for the workaround, which results in the correct coverage of 95.45% being reported.
- 主要语言
- Python
- 星标
- 91
- 派生
- 65
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
codecov/codecov-cli 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
codecov/codecov-cli#795 ·
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
codecov/codecov-cli#721 · 1 条评论 ·
-
bug
难度 3/5 1-2 天 新手友好度 59/100
codecov/codecov-cli#801 · 2 条评论 · 1 个 reaction ·
-
难度 3/5 1-2 天 新手友好度 65/100
codecov/codecov-cli#777 ·
-
难度 1/5 1 小时以内 新手友好度 5/100
codecov/codecov-cli#715 ·
查看 codecov/codecov-cli 的全部 Issue
相似的 Issue
-
namespace operations
难度 1/5 1 小时以内 新手友好度 72/100
EclipseFdn/open-vsx.org#14043 ·
维护者通常 1 天内回复
-
netbox status: needs triage type: bug
难度 2/5 1-3 小时 新手友好度 76/100
netbox-community/netbox#23376 ·
维护者通常 1 天内回复
-
feedback simulation workshop
难度 2/5 1-3 小时 新手友好度 73/100
githubnext/gh-aw-workshop#4455 ·
维护者通常 1 天内回复
-
Triage 🩺
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
[BUG] Container scenario crashes without expected_recovery_time, kube DNS example uses retry_wait未关闭needs-triage
难度 2/5 1-3 小时 新手友好度 77/100
krkn-chaos/krkn#1627 · 1 条评论 ·
维护者通常 1 天内回复