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

pytest-cov randomly fails with INTERNALERROR> coverage.misc.CoverageException: Can't combine line data with arc data #479

Open
jacek-jablonski opened this issue Jul 24, 2021 · 4 comments

Comments

@jacek-jablonski
Copy link

Summary

Running pytest with pytest-cov plugin or coverage standalone randomly results in error:

INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/Users/jacek/temp/coverage-error/.venv/lib/python3.8/site-packages/_pytest/main.py", line 269, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "/Users/jacek/temp/coverage-error/.venv/lib/python3.8/site-packages/_pytest/main.py", line 323, in _main
INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
INTERNALERROR>   File "/Users/jacek/temp/coverage-error/.venv/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "/Users/jacek/temp/coverage-error/.venv/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/Users/jacek/temp/coverage-error/.venv/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
INTERNALERROR>     self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR>   File "/Users/jacek/temp/coverage-error/.venv/lib/python3.8/site-packages/pluggy/callers.py", line 203, in _multicall
INTERNALERROR>     gen.send(outcome)
INTERNALERROR>   File "/Users/jacek/temp/coverage-error/.venv/lib/python3.8/site-packages/pytest_cov/plugin.py", line 271, in pytest_runtestloop
INTERNALERROR>     self.cov_controller.finish()
INTERNALERROR>   File "/Users/jacek/temp/coverage-error/.venv/lib/python3.8/site-packages/pytest_cov/engine.py", line 44, in ensure_topdir_wrapper
INTERNALERROR>     return meth(self, *args, **kwargs)
INTERNALERROR>   File "/Users/jacek/temp/coverage-error/.venv/lib/python3.8/site-packages/pytest_cov/engine.py", line 230, in finish
INTERNALERROR>     self.cov.stop()
INTERNALERROR>   File "/Users/jacek/temp/coverage-error/.venv/lib/python3.8/site-packages/coverage/control.py", line 701, in combine
INTERNALERROR>     combine_parallel_data(
INTERNALERROR>   File "/Users/jacek/temp/coverage-error/.venv/lib/python3.8/site-packages/coverage/data.py", line 117, in combine_parallel_data
INTERNALERROR>     data.update(new_data, aliases=aliases)
INTERNALERROR>   File "/Users/jacek/temp/coverage-error/.venv/lib/python3.8/site-packages/coverage/sqldata.py", line 574, in update
INTERNALERROR>     raise CoverageException("Can't combine line data with arc data")
INTERNALERROR> coverage.misc.CoverageException: Can't combine line data with arc data

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:

@sodul
Copy link

sodul commented Jul 30, 2021

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?

@jacek-jablonski
Copy link
Author

Hi @sodul,
Deleting .coverage doesn't change the situation. It still happens in a clean environment.

@sodul
Copy link

sodul commented Aug 2, 2021

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

@charmoniumQ
Copy link

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.

KSmanis added a commit to KSmanis/pip-autocompile that referenced this issue Jun 22, 2023
brynpickering added a commit to arup-group/pam that referenced this issue Jun 27, 2023
rebkwok added a commit to ebmdatalab/ebmbot that referenced this issue Jan 9, 2024
rebkwok added a commit to ebmdatalab/ebmbot that referenced this issue Jan 9, 2024
rebkwok added a commit to ebmdatalab/ebmbot that referenced this issue Jan 9, 2024
rebkwok added a commit to ebmdatalab/ebmbot that referenced this issue Jan 9, 2024
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

3 participants