traceback when combining data

Issue #414 invalid
Matthew Stoltenberg created an issue

Not sure if this is a problem with the new Coverage 4.0 or with the nose coverage plugin.

foo.py:

print("Hello World")

testfoo.py:

import os
import unittest

class FooTest(unittest.TestCase):

    def test_01(self):
        os.system('coverage run --branch --parallel-mode foo.py')

output:

(PY3ENV) $ nosetests --with-coverage footest.py 
Hello World
.
Traceback (most recent call last):
  File "/home/sto62746/work/coverage/PY3ENV/bin/nosetests", line 11, in <module>
    sys.exit(run_exit())
  File "/home/sto62746/work/coverage/PY3ENV/lib64/python3.4/site-packages/nose/core.py", line 121, in __init__
    **extra_args)
  File "/usr/lib64/python3.4/unittest/main.py", line 93, in __init__
    self.runTests()
  File "/home/sto62746/work/coverage/PY3ENV/lib64/python3.4/site-packages/nose/core.py", line 207, in runTests
    result = self.testRunner.run(self.test)
  File "/home/sto62746/work/coverage/PY3ENV/lib64/python3.4/site-packages/nose/core.py", line 66, in run
    result.printErrors()
  File "/home/sto62746/work/coverage/PY3ENV/lib64/python3.4/site-packages/nose/result.py", line 110, in printErrors
    self.config.plugins.report(self.stream)
  File "/home/sto62746/work/coverage/PY3ENV/lib64/python3.4/site-packages/nose/plugins/manager.py", line 99, in __call__
    return self.call(*arg, **kw)
  File "/home/sto62746/work/coverage/PY3ENV/lib64/python3.4/site-packages/nose/plugins/manager.py", line 167, in simple
    result = meth(*arg, **kw)
  File "/home/sto62746/work/coverage/PY3ENV/lib64/python3.4/site-packages/nose/plugins/cover.py", line 183, in report
    self.coverInstance.stop()
  File "/home/sto62746/work/coverage/PY3ENV/lib64/python3.4/site-packages/coverage/control.py", line 787, in combine
    self.data_files.combine_parallel_data(self.data, aliases=aliases, data_paths=data_paths)
  File "/home/sto62746/work/coverage/PY3ENV/lib64/python3.4/site-packages/coverage/data.py", line 700, in combine_parallel_data
    data.update(new_data, aliases=aliases)
  File "/home/sto62746/work/coverage/PY3ENV/lib64/python3.4/site-packages/coverage/data.py", line 475, in update
    raise CoverageException("Can't combine arc data with line data")
coverage.misc.CoverageException: Can't combine arc data with line data

version info

(PY3ENV) $ python --version
Python 3.4.2
(PY3ENV) $ pip list
coverage (4.0)
nose (1.3.7)
pip (7.1.2)
setuptools (12.0.3)

Comments (4)

  1. Ned Batchelder repo owner

    This happens because you are running coverage twice: once to measure testfoo.py, and then again in the subprocess to measure foo.py. But the outer one has branch=False (since you haven't specified it), and the inner one has branch=True. Use a .coveragerc file to set options that you want to apply everywhere.

    As an aside, using os.system to run coverage inside a test suite is a really odd thing to do. There are probably better ways to accomplish what you want. :)

  2. Matthew Stoltenberg reporter

    DOH! I didn't even notice I wasn't calling nosetests with --cover-branches. Apparently the older version of Coverage was more forgiving...

  3. Log in to comment