I have a multiprocessing application in python. And I am trying to get the coverage report after running my tests. I am trying to merge coverage reports but I am not able to do in a single shot.
Following is the issue I am facing. My two tests have generated 4 coverage files. And when I run the command "coverage combine" I get the following error:
Can't combine line data with arc data
To merge the coverage files I need to run "coverage combine" command 4 times. But I am planning to add more tests and that will make combining the reports even difficult.
So how can I combine all the coverage reports in a single go?
PS: I have set the configuration file as follows:
[run]
branch = True
parallel = True
concurrency = multiprocessing
[report]
# Regexes for lines to exclude from consideration
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover
And I am able to get the combined report correctly for line coverage.
EDIT:
This is how I run my application to get the coverage
coverage --rcfile=coverage_rc_file tester_script.py test1 test2
The above command runs my app twice and generates 4 coverage files.
Then I run the following command to combine the results:
coverage combine
The error you are seeing will happen if you use the command line to configure coverage, like this:
The problem is that the command line arguments aren't communicated down to the subprocesses, so the main process measures branch coverage, and the subprocesses measure line coverage. Then the combine step can't combine the files.
The fix is to use a .coveragerc configuration file. But you say you are using that, so I'm not sure what's going wrong, unless you had started with just command-line arguments.