Add some helpful messages to coverage script
Some checks failed
Cargo CI / Lint (pull_request) Successful in 1m0s
Cargo CI / Build and Test (pull_request) Failing after 1m17s

This commit is contained in:
Wojciech Kozlowski 2024-01-07 10:33:21 +01:00
parent 04c19ea3e0
commit 115373667f

View File

@ -1,12 +1,17 @@
import argparse
import json
import sys
def main(coverage_file, fail_under):
with open(coverage_file, encoding="utf-8") as f:
coverage_json = json.load(f)
coverage = float(coverage_json["message"][:-1])
return coverage >= fail_under
print(f"Code coverage: {coverage:.2f}%; Threshold: {fail_under:.2f}%")
success = coverage >= fail_under
if coverage < fail_under:
print("Insufficient code coverage", file=sys.stderr)
return success
if __name__ == "__main__":