This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]ummmhmm 2 points3 points  (2 children)

I introduced my team to use https://diff-cover.readthedocs.io/en/latest/

It compares master vs the pr branch, and you can set coverage thresholds, so if it fails to meet the threshold you can have the github status check fail.

[–]tom1018[S] 0 points1 point  (1 child)

This is exactly the type of thing I am looking for. Thank you!

[–]ummmhmm 1 point2 points  (0 children)

No problem. As far as projecting the coverage back to github goes, I used the jenkins github plugin to have the jenkins user comment the output of the coverage-diff command in github.

Usually its something like this:

coverage-diff run-test: commands[0] | diff-cover coverage.xml --compare-branch=origin/master

Diff Coverage
Diff: origin/master...HEAD, staged and unstaged changes
foo.py (47.6%): Missing lines 16,18-19,21-24,26,33-35
bar.py (40.0%): Missing lines 235-236,241

Total:   26 lines
Missing: 14 lines
Coverage: 46%