combine python coverage files?
I found a different solution. I used combine
feature (read here)So I run my coverage like: coverage run -p
and then I do coverage combine
.
That's all. It generates 1 combined report.
You can't combine .xml files, but you can combine the raw data files. Your workflow would look like this:
$ COVERAGE_FILE=.coverage_func coverage run the_functional_tests.py$ COVERAGE_FILE=.coverage_inte coverage run the_integration_tests.py$ coverage combine$ coverage xml
You can achieve same result by using appending option. Suppose you ran the coverage on three python scripts.After first coverage use -a for appending.
coverage run first.pycoverage run -a second.pycoverage run -a third.py
Print the report
coverage report -m
Output:Report
Name Stmts Miss Cover Missing----------------------------------------------first.py 97 1 99% 95second.py 1 0 100%third.py 10 0 100%----------------------------------------------TOTAL 108 1 99%