[BUG] XML generated from coverage.py `.coverage` doesn’t respect config
@thomasrockhu-codecov đang làm issue này rồi.
Từ ngày 26/2/2025.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
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.
- Ngôn ngữ chính
- Python
- Star
- 91
- Fork
- 64
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của codecov/codecov-cli
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
codecov/codecov-cli#795 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
codecov/codecov-cli#721 · 1 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 65/100
codecov/codecov-cli#777 ·
-
Codecov is joining HarnessĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 5/100
codecov/codecov-cli#715 ·
-
Remove prevent-cli from codecov-cli repoCó thể làm lại được @calvin-codecov đã nhận 153 ngày trước và không có pull request nào đang mở. Đang mở
codecov/codecov-cli#706 · 1 bình luận · 1 người được giao ·
Tất cả issue của codecov/codecov-cli
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
conda-forge/conda-build-feedstock#289 · 1 bình luận · 1 reaction ·
-
`pulptest` no longer works in 4.0.0: `ImportError: Start directory is not importable: 'pulp/tests'`Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
remove reddit feedsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
TomCasavant/ohio-sites#224 ·