Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

[BUG] XML generated from coverage.py `.coverage` doesn’t respect config

Đang mở
#648 0 bình luận 0 reaction 1 người được giao Xem trên GitHub

@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ả

codecov/codecov-cli enhancement Medium

Describe the bug
In my project, I configured coverage.py using pyproject.toml to

  • write all files into a test-files folder (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.

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%
------------------------------------------------------------------ TOTAL 110 5 95%

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

  1. set coverage.py’s report.exclude_also setting in a pyproject.toml to ignore some lines
  2. collect coverage in .coverage file and run coverage xml
  3. run codecov CLI’s upload (which will re-generate the XML)
  4. compare the XML you created with the one codecov’s CLI created

Expected behavior
either

  • coverage xml run from the codecov CLI uses the same config as when I run it, or
  • when the file passed via --file already exists, have the codecov CLI skip running coverage xml

Regression
This probably worked using the old coverage PyPI package, but IDK.

Screenshots
NA

Product Area
coverage

Versions

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

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của codecov/codecov-cli

Tất cả issue của codecov/codecov-cli

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.