fix: return target skip notes, print them in scope

build_target_cores_cache printed its INFO notes itself, so expected_pack_names wrote notes about platforms nobody asked for. The notes come back with the cache and target_scope, the command-line wrapper, prints them.
This commit is contained in:
Abdessamad Derraz committed 2026-11-21 16:43:46 +01:00
1 parent 57ee0cdd8f
commit 8787f453c7
5 files changed
+29 -21

No files matched your search

+5 -6
View File
@@ -6957,12 +6957,11 @@ class AnUnknownTargetIsRefusedUnderAll(unittest.TestCase):
from scripts.model.registry import list_registered_platforms
platforms = list_registered_platforms(str(ROOT / "platforms"))
with contextlib.redirect_stdout(io.StringIO()):
with self.assertRaises(ValueError):
build_target_cores_cache(platforms, "swtich", str(ROOT / "platforms"), is_all=True)
_cache, kept = build_target_cores_cache(
platforms, "switch", str(ROOT / "platforms"), is_all=True
)
with self.assertRaises(ValueError):
build_target_cores_cache(platforms, "swtich", str(ROOT / "platforms"), is_all=True)
_cache, kept, _notes = build_target_cores_cache(
platforms, "switch", str(ROOT / "platforms"), is_all=True
)
self.assertNotIn("bizhawk", kept)
self.assertIn("retroarch", kept)
+4 -5
View File
@@ -30,8 +30,7 @@ class CheckReadsTheTargetLikeTheBuild(unittest.TestCase):
def test_a_platform_without_a_target_file(self):
# 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()), self.assertRaises(ValueError):
with tempfile.TemporaryDirectory() as platforms, self.assertRaises(ValueError):
build_target_cores_cache(["recalbox"], "x86_64", platforms, is_all=True)
# The build never packs such a platform under the target, so the
# check refuses it too instead of reading the full pack.
@@ -262,9 +261,9 @@ class CrossReferenceReadsTheTargetAcrossPlatforms(unittest.TestCase):
profiles = load_emulator_profiles(str(REPO_ROOT / "emulators"))
with contextlib.redirect_stderr(io.StringIO()):
tree = tree_scope(None, "switch", platforms_dir, profiles)
cache, kept = build_target_cores_cache(
list_registered_platforms(platforms_dir), "switch", platforms_dir, is_all=True,
)
cache, kept, _notes = build_target_cores_cache(
list_registered_platforms(platforms_dir), "switch", platforms_dir, is_all=True,
)
self.assertEqual(tree.selected, kept)
self.assertIsNone(tree.platform)
expected: set[str] = set()
+8 -2
View File
@@ -19,7 +19,7 @@ from core.cli import SourceUnreadable
from core.github import github_token, _gh_cli_token
from model.profiles import select_emulator_profiles, ProfileSelectionError
from model.registry import list_registered_platforms
from model.targets import load_target_config, build_target_cores_cache
from model.targets import load_target_config, build_target_cores_cache, target_scope
from exporter import diffreport
import pipeline
from orchestrate import guards, labels, prepare, runner
@@ -312,7 +312,13 @@ class AMistypedTargetEndsEveryToolAlike(unittest.TestCase):
platforms = list_registered_platforms(str(REPO_ROOT / "platforms"))
out, err = io.StringIO(), io.StringIO()
with contextlib.redirect_stdout(out), contextlib.redirect_stderr(err):
build_target_cores_cache(platforms, "switch", str(REPO_ROOT / "platforms"), is_all=True)
_cache, _kept, notes = build_target_cores_cache(
platforms, "switch", str(REPO_ROOT / "platforms"), is_all=True
)
self.assertEqual(out.getvalue() + err.getvalue(), "")
self.assertTrue(any(n.startswith("INFO: Skipping") for n in notes))
with contextlib.redirect_stdout(out), contextlib.redirect_stderr(err):
target_scope(platforms, "switch", str(REPO_ROOT / "platforms"), is_all=True)
self.assertEqual(out.getvalue(), "")
self.assertIn("INFO: Skipping", err.getvalue())