From b14a35b7885fb4e7fb4135307d26d369d477f752 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Tue, 6 Oct 2026 01:49:24 +0200 Subject: [PATCH] test: keep validation index on platform cores --- tests/test_validation_scope.py | 43 ++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 tests/test_validation_scope.py diff --git a/tests/test_validation_scope.py b/tests/test_validation_scope.py new file mode 100644 index 00000000..d691e7d2 --- /dev/null +++ b/tests/test_validation_scope.py @@ -0,0 +1,43 @@ +"""The validation index only hears from the emulators the platform runs. + +Built over every profile, ZEsarUX (standalone, a 48K cpc6128.rom) and ePSXe +judged RetroArch packs and the gaps page listed five hash mismatches with no +object. verify and the builder pass resolve_platform_cores' selection; this +test fails if either hands the index the whole profile set again. +""" + +from __future__ import annotations + +import re +import unittest +from pathlib import Path + +REPO_ROOT = Path(__file__).resolve().parents[1] + + +class ValidationIndexScope(unittest.TestCase): + def test_no_index_over_every_profile(self): + pattern = re.compile(r"_build_validation_index\(\s*(emu_)?profiles\s*\)") + for name in ("verify.py", "generate_pack.py", "packverify.py", "packextras.py"): + source = (REPO_ROOT / "scripts" / name).read_text(encoding="utf-8") + with self.subTest(module=name): + self.assertIsNone(pattern.search(source)) + + def test_platform_paths_select_by_platform_cores(self): + verify = (REPO_ROOT / "scripts" / "verify.py").read_text(encoding="utf-8") + builder = (REPO_ROOT / "scripts" / "generate_pack.py").read_text(encoding="utf-8") + self.assertRegex( + verify, + r"plat_cores = resolve_platform_cores\(config, profiles\)\s+" + r"validation_index = _build_validation_index\(\s*" + r"\{name: profiles\[name\] for name in plat_cores\}", + ) + self.assertRegex( + builder, + r"for name in resolve_platform_cores\(config, emu_profiles\)\s*\}\s*" + r"validation_index = _build_validation_index\(platform_profiles\)", + ) + + +if __name__ == "__main__": + unittest.main()