Make database and library optional #86
@ -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