refactor: read target overrides through one reader

This commit is contained in:
Abdessamad Derraz committed 2026-11-21 05:59:51 +01:00
1 parent 812f2609db
commit 35f335d001
7 files changed
+97 -70

No files matched your search

+1 -1
View File
@@ -272,7 +272,7 @@ class CoreResolutionTests(unittest.TestCase):
}
}
self.assertEqual(
cf.unresolved_target_cores(targets, index, cf._platform_overrides(overrides, "plat")),
cf.unresolved_target_cores(targets, index, cf.platform_overrides(overrides, "plat")),
{"ghost": ["x86_64"]},
)
+1 -1
View File
@@ -625,7 +625,7 @@ class EveryTargetCoreReachesAProfile(unittest.TestCase):
continue
unresolved = check_freshness.unresolved_target_cores(
yaml.safe_load(Path(path).read_text()), index,
check_freshness._platform_overrides(overrides, platform),
check_freshness.platform_overrides(overrides, platform),
)
with self.subTest(platform=platform):
if platform == "retropie":
+26
View File
@@ -241,5 +241,31 @@ class PublishedListsAreNotNarrowed(unittest.TestCase):
self.assertEqual(data["regions"], [])
class AnEmptyOverrideIsNoOverride(unittest.TestCase):
"""`batocera:` or `board:` with no value raised AttributeError in the
builder and the installer lists, where check_freshness read it as none."""
def test_every_reader_takes_an_empty_value(self):
from model.targets import list_available_targets, load_target_config
from packs.targets import target_list
with tempfile.TemporaryDirectory(dir=REPO_ROOT / "tmp") as tmp:
targets = Path(tmp) / "targets"
targets.mkdir()
for platform in ("p", "q"):
(targets / f"{platform}.yml").write_text(
"targets:\n board:\n cores: [a]\n", encoding="utf-8"
)
(targets / "_overrides.yml").write_text(
"p:\nq:\n targets:\n board:\n", encoding="utf-8"
)
for platform in ("p", "q"):
with self.subTest(platform=platform):
self.assertEqual(load_target_config(platform, "board", tmp), {"a"})
self.assertEqual(list_available_targets(platform, tmp)[0]["aliases"], [])
self.assertEqual(target_list(targets / f"{platform}.yml"), {"board": ["a"]})
self.assertEqual(canonical_target_name(["p", "q"], "board", tmp), "board")
if __name__ == "__main__":
unittest.main()