From 9980a694e4286487c93839f41a9f95cde0fc247b Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Sat, 17 Oct 2026 12:32:20 +0200 Subject: [PATCH] refactor: read pack counts in one branch Also gives the platform typo test a scratch directory it removes. --- scripts/pipeline.py | 12 +++--------- tests/test_system_selection.py | 5 +++-- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/scripts/pipeline.py b/scripts/pipeline.py index 8e18d4b0..e142d25d 100644 --- a/scripts/pipeline.py +++ b/scripts/pipeline.py @@ -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 diff --git a/tests/test_system_selection.py b/tests/test_system_selection.py index 49611e6e..54d6b3f4 100644 --- a/tests/test_system_selection.py +++ b/tests/test_system_selection.py @@ -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):