in ci.py [0:0]
def check_ptr_stats_json(stats_file: Path) -> int:
stats_errors = 0
if not stats_file.exists():
print(f"{stats_file} stats file does not exist")
return 68
try:
with stats_file.open("r") as sfp:
stats_json = json.load(sfp)
except json.JSONDecodeError as jde:
print(f"Stats JSON Error: {jde}")
return 69
# Lets always print JSON to help debug any failures and have JSON history
print(json.dumps(stats_json, indent=2, sort_keys=True))
any_fail = int(stats_json["total.fails"]) + int(stats_json["total.timeouts"])
if any_fail:
print(f"Stats report {any_fail} fails/timeouts", file=sys.stderr)
return any_fail
if int(stats_json["total.setup_pys"]) > 1:
print("Somehow we had more than 1 setup.py - What?", file=sys.stderr)
stats_errors += 1
if int(stats_json["pct.setup_py_ptr_enabled"]) != 100:
print("We didn't test all setup.py files ...", file=sys.stderr)
stats_errors += 1
# TODO: Make getting project name better - For now quick CI hack
coverage_key_count = 0
for key in stats_json.keys():
if "_coverage." in key:
coverage_key_count += 1
if coverage_key_count != 4:
print("We didn't get coverage stats for all ptr files + total", file=sys.stderr)
stats_errors += 1
print(f"Stats check found {stats_errors} error(s)")
return stats_errors