test: reject malformed coverage metrics

This commit is contained in:
Joseph Magly
2026-08-14 11:44:12 -04:00
parent f17fd68f77
commit d5a02bd748
2 changed files with 19 additions and 1 deletions
+6 -1
View File
@@ -4,6 +4,7 @@ from __future__ import annotations
import argparse
import json
import math
from pathlib import Path
from typing import Any
@@ -23,7 +24,11 @@ def validate_coverage(
)
for label, key, minimum in metrics:
value = totals.get(key)
if not isinstance(value, (int, float)):
if (
isinstance(value, bool)
or not isinstance(value, (int, float))
or not math.isfinite(value)
):
failures.append(f"coverage report is missing numeric {key}")
elif value < minimum:
failures.append(