0% coverage report instead of actual percentage
Closed this issue · 5 comments
Hi, the coverage on our project is reported as 0% in the HTML report and badge while the coverage report
command does produce non-zero results:
coverage: commands[1]> coverage report
Name Stmts Miss Cover
--------------------------------------------------------
src/claranet_tfwrapper/__init__.py 861 182 79%
src/claranet_tfwrapper/azure.py 84 27 68%
src/claranet_tfwrapper/utils.py 10 0 100%
--------------------------------------------------------
TOTAL 955 209 78%
I've checked the relevant parts of our Github Actions CI, notably relative_files = true
is set. And compared that to the provided examples:
- https://github.com/py-cov-action/python-coverage-comment-action-v3-example/blob/main/.github/workflows/ci.yml
- https://github.com/py-cov-action/python-coverage-comment-action?tab=readme-ov-file#merging-multiple-coverage-reports
There is no warning when coverage is collected:
coverage: OK (28.25=setup[1.20]+cmd[26.74,0.15,0.16] seconds)
congratulations :) (28.50 seconds)
Nor when it is processed:
Notice: Starting action
Notice: HTTP Request: GET https://api.github.com/repos/claranet/tfwrapper "HTTP/1.1 [20](https://github.com/claranet/tfwrapper/actions/runs/8364151688/job/22898834415#step:5:21)0 OK"
Notice: Computing coverage files & badge
Notice: HTTP Request: GET https://img.shields.io/static/v1?label=Coverage&message=0%25&color=red "HTTP/1.1 200 OK"
Notice: Generating HTML coverage report
Notice: Saving coverage files
Notice: Files saved
Notice: You can browse the full coverage report at:
https://htmlpreview.github.io/?https://github.com/claranet/tfwrapper/blob/python-coverage-comment-action-data/htmlcov/index.html
Right now, I'm a bit clueless about what could be wrong.
Any idea? 🙏
Hello,
Indeed, something seems strange here.
I downloaded the 5 artifacts uploaded here, then cloned your repo, and launched coverage combine
and coverage report
and it says...
$ coverage report
Name Stmts Miss Cover
--------------------------------------------------------
src/claranet_tfwrapper/__init__.py 861 861 0%
src/claranet_tfwrapper/azure.py 84 84 0%
src/claranet_tfwrapper/utils.py 10 10 0%
--------------------------------------------------------
TOTAL 955 955 0%
So at least, there's nothing that causes that in the python-coverage-comment-action. Either it's a bug in coverage or a bug in the setup. That said, you've followed the instructions we outlined, so I want to continue digging deeper.
Would you mind trying if adding COVERAGE_PATH: src/
is enough to solve your issue? If not, I'll fork and run my own experiments, but from looking at it, it seems by far as the most plausible lead.
Will do ASAP, thanks!
Thanks to your comment, I've figured that the issue was caused by the fact that relative_files = true
was set during the first coverage execution but not during coverage combine
/coverage report
execution.
I've moved that option to the .coveragerc
configuration file, added that file to git, and it resolved the issue.
Perfect, happy that I was any help :)
Happy covering !