Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coveralls doesn't recognize relevant lines, says coverage 100% #194

Open
lpenz opened this issue Oct 31, 2023 · 1 comment
Open

coveralls doesn't recognize relevant lines, says coverage 100% #194

lpenz opened this issue Oct 31, 2023 · 1 comment

Comments

@lpenz
Copy link

lpenz commented Oct 31, 2023

Github action execution: https://github.com/lpenz/ptvertmenu/actions/runs/6699984703/job/18205107235
We got the following result (printed under lpenz/ghaction-pytest-cov):

   Name                                  Stmts   Miss  Cover
  ---------------------------------------------------------
  src/ptvertmenu/__init__.py                5      0   100%
  src/ptvertmenu/vertmenu.py               79     63    20%
  src/ptvertmenu/vertmenuuicontrol.py     114     78    32%
  tests/test_basic.py                       5      0   100%
  ---------------------------------------------------------
  TOTAL                                   203    141    31%

That's uploaded to coveralls. But the coverage result in the corresponding page at https://coveralls.io/builds/63640062 is 100% coverage, not 31%.

I can't really tell what breaks it, because I have the exact same scheme in another module, and coverage works ok:
https://github.com/lpenz/disk-img-tool/actions/runs/6697777869/job/18198389253
https://coveralls.io/builds/63634714
(it's higher, but not 100%)

@lpenz
Copy link
Author

lpenz commented Feb 17, 2024

Found the problem.

pytest --cov by default produces a .coverage file that coveralls uses but doesn't completely understands (either that or the file doesn't have all the coverage information).

Running pytest --cov=./ --cov-report=xml generates a coverage.xml file that coveralls understand perfectly BUT it also generates the .coverage file. Coveralls then uses both, and the problem persists.

I was able to solve this in my repos by running pytest --cov=./ --cov-report=xml AND then rm -f .coverage. Getting rid of that file makes coveralls use only coverage.xml which is correctly understands, and now I have proper coverage information for python.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant