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.
This commit is contained in:
Abdessamad Derraz committed 2026-10-20 03:37:57 +02:00
1 parent 7edd438af1
commit 1458f68b0d
1 file changed
+8 -5
+8 -5
View File
@@ -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):