Skip to content

Commit f5eb5f2

Browse files
Extending jsonreport.py to also include all branch attributes
Signed-off-by: Salvatore Zagaria <[email protected]>
1 parent 1720459 commit f5eb5f2

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

CONTRIBUTORS.txt

+1
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ Rodrigue Cloutier
114114
Roger Hu
115115
Ross Lawley
116116
Roy Williams
117+
Salvatore Zagaria
117118
Sandra Martocchia
118119
Scott Belden
119120
Sigve Tjora

coverage/jsonreport.py

+2
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ def report(self, morfs, outfile=None):
6060
self.report_data["totals"].update({
6161
'num_branches': self.total.n_branches,
6262
'num_partial_branches': self.total.n_partial_branches,
63+
'covered_branches': self.total.n_executed_branches,
64+
'missing_branches': self.total.n_missing_branches,
6365
})
6466

6567
json.dump(

tests/test_json.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ def test_branch_coverage(self):
6565
'num_branches': 2,
6666
'excluded_lines': 0,
6767
'num_partial_branches': 1,
68-
'percent_covered': 60.0
68+
'percent_covered': 60.0,
69+
'covered_branches': 1,
70+
'missing_branches': 1
6971
}
7072
}
7173
self._assert_expected_json_report(cov, expected_result)

0 commit comments

Comments
 (0)