From 1458f68b0dbf34e88e2483cb37707ee1669247b4 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Tue, 20 Oct 2026 03:37:57 +0200 Subject: [PATCH] fix: test the targetless platform contract A platform without hardware targets is now left out of a targeted --all run instead of being built unfiltered, and a run no platform can honour is refused. --- tests/test_target_verify.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/test_target_verify.py b/tests/test_target_verify.py index d9157b38..d9f895ec 100644 --- a/tests/test_target_verify.py +++ b/tests/test_target_verify.py @@ -10,6 +10,8 @@ traceback after every pack had been written. from __future__ import annotations import sys +import contextlib +import io import tempfile import unittest from pathlib import Path @@ -23,11 +25,12 @@ from generate_pack import _target_cores_for # noqa: E402 class CheckReadsTheTargetLikeTheBuild(unittest.TestCase): def test_a_platform_without_a_target_file(self): - with tempfile.TemporaryDirectory() as platforms: - built, kept = build_target_cores_cache( - ["recalbox"], "x86_64", platforms, is_all=True - ) - self.assertEqual((built, kept), ({"recalbox": None}, ["recalbox"])) + # Left out of a targeted --all run rather than built unfiltered, and + # a run where no platform has the target is refused. + with tempfile.TemporaryDirectory() as platforms, \ + contextlib.redirect_stdout(io.StringIO()): + with self.assertRaises(ValueError): + build_target_cores_cache(["recalbox"], "x86_64", platforms, is_all=True) self.assertIsNone(_target_cores_for("recalbox", "x86_64", platforms)) def test_a_platform_with_a_target_file_is_narrowed(self):