Open jacek-jablonski opened 3 years ago
I had something very similar with green
, not pytest
, and it turned out to be caused by a stale .coverage
file. Deleting that file completely resolved it for me. Have you double checked that this is reproducible in a clean environment, and if not maybe have pytest-cov
delete the .coverage
file before a run?
Hi @sodul, Deleting .coverage doesn't change the situation. It still happens in a clean environment.
Ok. What I seem to understand from the error message is that the coverage information gets 'corrupted'
and when coverage.py tries to aggregate the data it barfs by saying that line coverage and branch coverage (that's what I suppose arc data
means here) cannot be combined.
Personally I do believe that there might be something wrong in pytest-cov that triggers the bug, the bug itself is very likely in coverage.py itself since coverage.py is the one reading/writing the data and it ends up not agreeing with itself.
I'm not a coverage.py maintainer and I do not use pytest so I'm not able to help more than sharing my own experience with this error message.
Good luck @jacek-jablonski
the bug itself is very likely in coverage.py itself since coverage.py is the one reading/writing the data and it ends up not agreeing with itself.
Meanwhile, coverage.py people say (nedbat/coveragepy/issues/512)
it seems to be about pytest-cov, not coverage.py, and 2) there's a fix, which is to explicitly name your coverage configuration file with
--cov-config
.
Summary
Running pytest with pytest-cov plugin or coverage standalone randomly results in error:
Expected vs actual result
pytest-cov running without error
Reproducer
Minimal example: https://github.com/jacek-jablonski/coverage-test-error
Versions
Output of relevant packages
pip list
,python --version
,pytest --version
etc.coverage=5.5 pytest=6.2.4 pytest-cov=2.12.1
Config
Provided in a minimal example
Code
Provided in a minimal example
If you paste raw code make sure you quote it, eg: