Skip to content

Commit cf86b98

Browse files
committed
ci(coverage): make health check robust to un-loadable (chemistry/cantera) cases
The daily Coverage Map Health job runs only ./mfc.sh init (no cantera), so loading chemistry example case files (nD_perfect_reactor, 1D_inert_shocktube) crashed the check with ModuleNotFoundError. Skip any case that fails to load and log it, instead of aborting. map_health measures the fraction of loadable current tests that are mapped, so a smaller current_keys cannot cause a false 'stale' result. The map itself was healthy; only the check was brittle.
1 parent 47b56e8 commit cf86b98

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

.github/scripts/check_coverage_map_health.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,22 @@
1313
entries, meta = load_map(COVERAGE_MAP_PATH)
1414
if entries is None:
1515
sys.exit("Coverage map missing or corrupt.")
16-
current_keys = {b.to_case().coverage_key() for b in list_cases()}
16+
# Compute each current test's coverage key. Loading a case executes its case
17+
# file; some (e.g. chemistry examples) import optional deps like cantera that are
18+
# not installed in this lightweight job. Skip any case that fails to load instead
19+
# of crashing — map_health measures the fraction of *loadable* current tests that
20+
# are mapped, so a smaller current_keys cannot produce a false "stale" result.
21+
current_keys = set()
22+
unloadable = []
23+
for b in list_cases():
24+
try:
25+
current_keys.add(b.to_case().coverage_key())
26+
except Exception as exc: # noqa: BLE001 — a case file that won't import must not crash the health check
27+
unloadable.append((getattr(b, "trace", repr(b)), str(exc).strip().splitlines()[-1][:140]))
28+
if unloadable:
29+
print(f"Note: {len(unloadable)} case(s) could not be loaded in this lightweight job (excluded from the check):")
30+
for trace, err in unloadable[:15]:
31+
print(f" - {trace}: {err}")
1732
ok, msg = map_health(
1833
meta=meta,
1934
current_keys=current_keys,

0 commit comments

Comments
 (0)