Skip to content

Commit

Permalink
New JSON info should be reported on individual files also.
Browse files Browse the repository at this point in the history
  • Loading branch information
nedbat committed Apr 11, 2020
1 parent b1194fb commit b79005b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ want to know what's different in 5.0 since 4.5.x, see :ref:`whatsnew5x`.
Unreleased
----------

- The JSON report now includes counts of covered and missing branches. Thanks,
Salvatore Zagaria.

- On Python 3.8, try-finally-return reported wrong branch coverage with
decorated async functions (`issue 946`_). This is now fixed. Thanks, Kjell
Braden.
Expand Down
2 changes: 2 additions & 0 deletions coverage/jsonreport.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,7 @@ def report_one_file(self, coverage_data, analysis):
reported_file['summary'].update({
'num_branches': nums.n_branches,
'num_partial_branches': nums.n_partial_branches,
'covered_branches': nums.n_executed_branches,
'missing_branches': nums.n_missing_branches,
})
return reported_file
6 changes: 4 additions & 2 deletions tests/test_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ def test_branch_coverage(self):
'num_branches': 2,
'excluded_lines': 0,
'num_partial_branches': 1,
'percent_covered': 60.0
'covered_branches': 1,
'missing_branches': 1,
'percent_covered': 60.0,
}
}
},
Expand All @@ -67,7 +69,7 @@ def test_branch_coverage(self):
'num_partial_branches': 1,
'percent_covered': 60.0,
'covered_branches': 1,
'missing_branches': 1
'missing_branches': 1,
}
}
self._assert_expected_json_report(cov, expected_result)
Expand Down

0 comments on commit b79005b

Please sign in to comment.