[MCCS-660] branch coverage support
The SKA Software Testing Policy and Strategy recommends using branch coverage where possible, instead of just line/statement coverage.
MCCS uses branch coverage. Our terminal report displays a TOTAL coverage of 74%.
...
src/ska_low_mccs/tile/tpm_driver.py 350 223 42 1 33%
src/ska_low_mccs/transient_buffer.py 49 3 4 1 92%
----------------------------------------------------------------------------------------------
TOTAL 8088 1832 1442 239 74%
Gitlab Analytics scrapes coverage from the terminal report, so it too displays 74%.
But our coverage badge displays 77%, because it displays the line rate.
This 3% difference doesn't matter at all... but it is still driving us all insane.
This MR provides for parse_coverage()
to return the same percentage as the terminal report, regardless of whether branch coverage has been included.
(When branch coverage has been included, the terminal report calculates the TOTAL coverage as
(lines_covered+branches_covered)/(total_lines+total_branches)
This value is not in the XML, but the four values needed to calculate it are. The calculation is undocumented but you can see it in the code here: https://github.com/nedbat/coveragepy/blob/4401a6c182a15c11042ba67153516e067063d406/coverage/results.py#L243.)