Add some helpful messages to coverage script
This commit is contained in:
parent
04c19ea3e0
commit
115373667f
@ -1,12 +1,17 @@
|
|||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
def main(coverage_file, fail_under):
|
def main(coverage_file, fail_under):
|
||||||
with open(coverage_file, encoding="utf-8") as f:
|
with open(coverage_file, encoding="utf-8") as f:
|
||||||
coverage_json = json.load(f)
|
coverage_json = json.load(f)
|
||||||
coverage = float(coverage_json["message"][:-1])
|
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__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
Reference in New Issue
Block a user