Skip to content

Commit

Permalink
Extending jsonreport.py to also include all branch attributes
Browse files Browse the repository at this point in the history
Signed-off-by: Salvatore Zagaria <salvatore.zagaria@vector.com>
  • Loading branch information
SalvatoreZagaria committed Apr 7, 2020
1 parent 1720459 commit f5eb5f2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CONTRIBUTORS.txt
Expand Up @@ -114,6 +114,7 @@ Rodrigue Cloutier
Roger Hu
Ross Lawley
Roy Williams
Salvatore Zagaria
Sandra Martocchia
Scott Belden
Sigve Tjora
Expand Down
2 changes: 2 additions & 0 deletions coverage/jsonreport.py
Expand Up @@ -60,6 +60,8 @@ def report(self, morfs, outfile=None):
self.report_data["totals"].update({
'num_branches': self.total.n_branches,
'num_partial_branches': self.total.n_partial_branches,
'covered_branches': self.total.n_executed_branches,
'missing_branches': self.total.n_missing_branches,
})

json.dump(
Expand Down
4 changes: 3 additions & 1 deletion tests/test_json.py
Expand Up @@ -65,7 +65,9 @@ def test_branch_coverage(self):
'num_branches': 2,
'excluded_lines': 0,
'num_partial_branches': 1,
'percent_covered': 60.0
'percent_covered': 60.0,
'covered_branches': 1,
'missing_branches': 1
}
}
self._assert_expected_json_report(cov, expected_result)
Expand Down

0 comments on commit f5eb5f2

Please sign in to comment.