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

CoverageException: Can't combine line data with arc data when updating to repository tip #399

Closed
nedbat opened this issue Aug 19, 2015 · 4 comments
Labels
bug Something isn't working combine

Comments

@nedbat
Copy link
Owner

nedbat commented Aug 19, 2015

Originally reported by Florian Bruhin (Bitbucket: The-Compiler, GitHub: The-Compiler)


After updating from 3.7.1 to the repository tip, I get this when running my tests:

[...]
  File "/home/florian/proj/qutebrowser/git/.tox/py34/lib/python3.4/site-packages/pytest_cov/plugin.py", line 156, in pytest_sessionfinish
    self.cov_controller.finish()
  File "/home/florian/proj/qutebrowser/git/.tox/py34/lib/python3.4/site-packages/pytest_cov/engine.py", line 123, in finish
    self.cov.combine()
  File "/home/florian/proj/qutebrowser/git/.tox/py34/lib/python3.4/site-packages/coverage/control.py", line 781, in combine
    self.data_files.combine_parallel_data(self.data, aliases=aliases, data_paths=data_paths)
  File "/home/florian/proj/qutebrowser/git/.tox/py34/lib/python3.4/site-packages/coverage/data.py", line 649, in combine_parallel_data
    data.update(new_data, aliases=aliases)
  File "/home/florian/proj/qutebrowser/git/.tox/py34/lib/python3.4/site-packages/coverage/data.py", line 434, in update
    raise CoverageException("Can't combine line data with arc data")
coverage.misc.CoverageException: Can't combine line data with arc data

It goes away when deleting .coverage.

I can't reproduce it with a minimal example, but here is how you should be able to reproduce it:

  • Install tox and PyQt, see this document
  • Clone https://github.com/The-Compiler/qutebrowser
  • Run tox -e py34 (note: some windows will pop-up and close during the test, so it's best to not do anything in the meantime - the testsuite should take about 30-60 seconds)
  • Change tox.ini to use the hg version:
diff --git a/tox.ini b/tox.ini
index [d78d979 (bb)](https://bitbucket.org/ned/coveragepy/commits/d78d979)..e4777ea [100644 (bb)](https://bitbucket.org/ned/coveragepy/commits/100644)
--- a/tox.ini
+++ b/tox.ini
@@ -22,7 +22,7 @@ deps =
     pytest-html==1.5.1
     hypothesis==1.10.1
     hypothesis-pytest==0.17.0
-    coverage==3.7.1
+    hg+https://bitbucket.org/ned/coveragepy
     pytest-cov==2.0.0
     cov-core==1.15.0
     beautifulsoup4==4.4.0
  • If it's present (it shouldn't), remove .coverage.xml as this will cause other issues
  • Re-run the command above.

I attached .coverage before and after running 4.0 (the latter was named .coverage.ws042.24666.991896 - I guess it gets renamed later and it crashed before that?)


@nedbat
Copy link
Owner Author

nedbat commented Aug 19, 2015

I've reproduced this locally, working on understanding what's going on...

@nedbat
Copy link
Owner Author

nedbat commented Aug 19, 2015

Original comment by Florian Bruhin (Bitbucket: The-Compiler, GitHub: The-Compiler)


I can reproduce this with this minimal example, without doing the 3.7.1 -> 4.0 switch:

import sys
import subprocess

def test_foo():
    subprocess.check_call([sys.executable, '-c', 'print("Hello World")'])

I guess it has something to do with pytest-cov turning subprocess coverage on automatically.

@nedbat
Copy link
Owner Author

nedbat commented Aug 20, 2015

Original comment by Florian Bruhin (Bitbucket: The-Compiler, GitHub: The-Compiler)


The above sample is actually flawed - it only worked because my conftest.py (pytest configuration file) imported something from qutebrowser, otherwise no data would be collected.

Here is a truly standalone example:

$ virtualenv .venv --python=python3

$ ./.venv/bin/pip install hg+https://bitbucket.org/ned/coveragepy pytest pytest-cov
Collecting hg+https://bitbucket.org/ned/coveragepy                                   
  Cloning hg https://bitbucket.org/ned/coveragepy to /tmp/pip-q_79karm-build
Collecting pytest
  Using cached pytest-2.7.2-py2.py3-none-any.whl
Collecting pytest-cov
  Using cached pytest_cov-2.0.0-py2.py3-none-any.whl
Collecting py>=1.4.29 (from pytest)
  Using cached py-1.4.30-py2.py3-none-any.whl
[...]

$ mkdir pkg
$ echo pass > pkg/mod.py

$ cat > .coveragerc
[run]
branch = true

$ cat > test_foo.py
import sys
import subprocess

from pkg import mod

def test_foo():
        subprocess.check_call([sys.executable, '-c', 'print("Hello World")'])

$ ./.venv/bin/python -m py.test test_foo.py --cov pkg
[...]

test_foo.py .Traceback (most recent call last):
[...]
  File "/home/florian/tmp/coverage_issue/.venv/lib/python3.4/site-packages/pytest_cov/plugin.py", line 156, in pytest_sessionfinish
    self.cov_controller.finish()
  File "/home/florian/tmp/coverage_issue/.venv/lib/python3.4/site-packages/pytest_cov/engine.py", line 123, in finish
    self.cov.combine()
  File "/home/florian/tmp/coverage_issue/.venv/lib/python3.4/site-packages/coverage/control.py", line 781, in combine
    self.data_files.combine_parallel_data(self.data, aliases=aliases, data_paths=data_paths)
  File "/home/florian/tmp/coverage_issue/.venv/lib/python3.4/site-packages/coverage/data.py", line 649, in combine_parallel_data
    data.update(new_data, aliases=aliases)
  File "/home/florian/tmp/coverage_issue/.venv/lib/python3.4/site-packages/coverage/data.py", line 434, in update
    raise CoverageException("Can't combine line data with arc data")
coverage.misc.CoverageException: Can't combine line data with arc data

@nedbat
Copy link
Owner Author

nedbat commented Aug 20, 2015

Fixed in 74e2f7c366a2 (bb)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working combine
Projects
None yet
Development

No branches or pull requests

1 participant