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

Issue #399 resolved
Florian Bruhin
created an issue

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..e4777ea 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?)

Comments (5)

  1. Florian Bruhin reporter

    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.

  2. Florian Bruhin reporter

    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
    
  3. Log in to comment