Skip to content

Commit

Permalink
Add coverage check for complete coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
wbyoung committed Jun 23, 2024
1 parent 5c3648b commit ddb5812
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/validate_coverage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""Update the manifest file."""

import json
import sys


def validate_coverage():
coverage = json.loads(sys.stdin.read())
totals = coverage["totals"]

def exit_unless(key, value):
if totals[key] != value:
print(f"Coverage check: totals.{key} is expected to be {value}")
sys.exit(1)

exit_unless("percent_covered", 100.0)
exit_unless("missing_lines", 0)
exit_unless("num_partial_branches", 0)
exit_unless("missing_branches", 0)

print("Coverage check completed")


validate_coverage()
3 changes: 3 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ jobs:
- name: Test with pytest
run: |
pytest
- name: Validate coverage
run: |
coverage json -q -o - | python3 .github/validate_coverage.py

0 comments on commit ddb5812

Please sign in to comment.