refactor: read pack counts in one branch

Also gives the platform typo test a scratch directory it removes.
This commit is contained in:
Abdessamad Derraz committed 2026-10-17 12:32:20 +02:00
1 parent b6331a765a
commit 9980a694e4
2 files changed
+6 -11

No files matched your search

+3 -9
View File
@@ -106,16 +106,10 @@ def parse_pack_counts(output: str) -> dict[str, tuple[int, int]]:
continue
if "files packed" not in line:
continue
# New format: "622 files packed (359 baseline + 263 from cores), 358/359 files OK"
base_m = re.search(r"\((\d+) baseline", line)
# "622 files packed (359 baseline + 263 from cores), 358/359 files OK"
ok_m = re.search(r"(\d+)/(\d+) files OK", line)
if base_m and ok_m:
ok, total = int(ok_m.group(1)), int(ok_m.group(2))
counts[current_label] = (ok, total)
elif ok_m:
# Fallback: old format without baseline
ok, total = int(ok_m.group(1)), int(ok_m.group(2))
counts[current_label] = (ok, total)
if ok_m:
counts[current_label] = (int(ok_m.group(1)), int(ok_m.group(2)))
return counts
+3 -2
View File
@@ -95,8 +95,9 @@ class AMistypedPlatformIsNamed(unittest.TestCase):
ran its whole build first and then said "no pack for batocra"."""
def test_every_cli_names_the_platform_it_meant(self):
out = Path(tempfile.mkdtemp(dir=REPO_ROOT / "tmp"))
out.rmdir()
scratch = tempfile.TemporaryDirectory(dir=REPO_ROOT / "tmp")
self.addCleanup(scratch.cleanup)
out = Path(scratch.name) / "packs"
for script, extra in (("verify.py", []), ("cross_reference.py", []),
("generate_pack.py", ["--offline", "--output-dir", str(out)])):
with self.subTest(script=script):