diff --git a/scripts/orchestrate/narrowed.py b/scripts/orchestrate/narrowed.py index 48ef23e2f..62d7abbb4 100644 --- a/scripts/orchestrate/narrowed.py +++ b/scripts/orchestrate/narrowed.py @@ -135,7 +135,7 @@ def check_narrowed_packs( name = f"{platform} {label}" if report is None: # The builder declines a system no core of the platform runs. - print(f" {name}: the builder wrote no pack") + print(f" {name}: the builder wrote no pack: {built.refusal}") all_ok = False continue credited = set(report["pack_destinations"]) diff --git a/tests/test_pack_destinations.py b/tests/test_pack_destinations.py index 03595801a..f3d7dcc1b 100644 --- a/tests/test_pack_destinations.py +++ b/tests/test_pack_destinations.py @@ -236,6 +236,27 @@ class EveryNarrowingIsCompared(unittest.TestCase): source = script_source("pipeline.py") self.assertIn("ok = check_narrowed_packs(", source) + def test_a_refused_pack_names_the_reason(self): + """The builder's refusal went into a discarded stdout: the step said + only that no pack was written.""" + from unittest import mock + + from orchestrate import narrowed + from packs import platformpack + + refused = platformpack.PlatformPackOutcome(zip_path=None, refusal="no core runs x") + inputs = ({}, {}, {}, {}, [(["p"], "p")]) + printed = io.StringIO() + with mock.patch.object(narrowed, "comparison_inputs", return_value=inputs), \ + mock.patch.object(narrowed, "narrowed_variants", + return_value=[("--system x", {"system_filter": ["x"]})]), \ + mock.patch("model.platforms.load_platform_config", return_value={}), \ + mock.patch.object(platformpack, "build_platform_pack", return_value=refused), \ + contextlib.redirect_stdout(printed): + self.assertFalse(narrowed.check_narrowed_packs()) + self.assertIn("p --system x: the builder wrote no pack: no core runs x", + printed.getvalue()) + class ThePipelineComparesPaths(unittest.TestCase): """Equal counts, other paths: the comparison fails and names both sides."""