diff --git a/scripts/generate_site.py b/scripts/generate_site.py index d01343075..6fe7b38ca 100644 --- a/scripts/generate_site.py +++ b/scripts/generate_site.py @@ -1035,6 +1035,20 @@ def _split_contract(config: dict) -> tuple[dict, dict]: """ allowed = _contract_keys() contract = {key: value for key, value in config.items() if key in allowed} + # platform_system is the resolver's copy of the key each entry sits under. + if isinstance(contract.get("systems"), dict): + contract["systems"] = { + sys_id: { + **system, + "files": [ + {k: v for k, v in f.items() if k != "platform_system"} + for f in system["files"] + ], + } + if isinstance(system, dict) and system.get("files") + else system + for sys_id, system in contract["systems"].items() + } registry = {key: value for key, value in config.items() if key not in allowed and key != "_key"} # The merged config gives a child its parent's release_pack: Lakka and diff --git a/tests/test_db_aliases.py b/tests/test_db_aliases.py index e868047f6..91bfd56fa 100644 --- a/tests/test_db_aliases.py +++ b/tests/test_db_aliases.py @@ -247,7 +247,7 @@ class AliasesFollowContentNotPrimaryCopy(unittest.TestCase): def test_the_build_passes_the_scan_copies(self): source = (REPO_ROOT / "scripts" / "generate_db.py").read_text(encoding="utf-8") - self.assertIn("_collect_all_aliases(files, aliases)", source) + self.assertIn("_collect_all_aliases(files, aliases, shadowed)", source) class TheSmsBiosKeepsItsNames(unittest.TestCase): diff --git a/tests/test_platform_inheritance.py b/tests/test_platform_inheritance.py index df2df7c38..d79aeeaf8 100644 --- a/tests/test_platform_inheritance.py +++ b/tests/test_platform_inheritance.py @@ -51,7 +51,10 @@ class AChildLeavesItsParentAlone(unittest.TestCase): self.load("child") parent = self.load("parent") self.assertEqual(list(parent["systems"]), ["sys-a"]) - self.assertEqual(parent["systems"]["sys-a"]["files"], [{"name": "a.bin"}]) + self.assertEqual( + parent["systems"]["sys-a"]["files"], + [{"name": "a.bin", "platform_system": "sys-a"}], + ) def test_the_child_reads_its_own_registry_entry_first(self): self.load("parent") @@ -59,7 +62,10 @@ class AChildLeavesItsParentAlone(unittest.TestCase): self.assertEqual((child["status"], child["scraper"]), ("archived", "child")) # What it does not say comes from its parent's entry. self.assertEqual((child["hash_type"], child["cores"]), ("md5", "all_libretro")) - self.assertEqual(child["systems"]["sys-a"]["files"], [{"name": "child.bin"}]) + self.assertEqual( + child["systems"]["sys-a"]["files"], + [{"name": "child.bin", "platform_system": "sys-a"}], + ) diff --git a/wiki/testing-guide.md b/wiki/testing-guide.md index ed925b0e1..c9c2693d0 100644 --- a/wiki/testing-guide.md +++ b/wiki/testing-guide.md @@ -50,7 +50,7 @@ Every module in `tests/`, by the area it guards. | Area | Fixtures | Modules | |------|----------|---------| | Core regression suites | synthetic | `test_e2e`, `test_audit_regressions`, `test_tool_messages` | -| File resolution and identity | synthetic + collection | `test_adler32_resolution`, `test_agnostic_scan`, `test_agnostic_scan_mode`, `test_agnostic_scope`, `test_agnostic_substitute`, `test_archive_choice`, `test_archive_recipes`, `test_bios_companions`, `test_bundled_identity`, `test_casefold_cache`, `test_db_aliases`, `test_declared_names`, `test_derivations`, `test_directory_entries`, `test_extra_identity`, `test_foreign_tree`, `test_foreign_tree_names`, `test_frontend_digest`, `test_game_data_homonyms`, `test_hashing`, `test_identity`, `test_md5_pack_context`, `test_name_tiebreak`, `test_nec_filing`, `test_np2_fonts`, `test_owner_resolution`, `test_path_suffix`, `test_resolution_evidence`, `test_sega_filing`, `test_shipped_content`, `test_twin_declarations`, `test_validated_choice`, `test_variant_choice`, `test_variant_identity`, `test_zipped_member` | +| File resolution and identity | synthetic + collection | `test_adler32_resolution`, `test_agnostic_scan`, `test_agnostic_scan_mode`, `test_agnostic_scope`, `test_agnostic_substitute`, `test_archive_choice`, `test_archive_recipes`, `test_bios_companions`, `test_bundled_identity`, `test_casefold_cache`, `test_db_aliases`, `test_declared_names`, `test_derivations`, `test_directory_entries`, `test_extra_identity`, `test_foreign_tree`, `test_foreign_tree_names`, `test_frontend_digest`, `test_game_data_homonyms`, `test_hashing`, `test_identity`, `test_maker_folder_names`, `test_md5_pack_context`, `test_name_tiebreak`, `test_nec_filing`, `test_np2_fonts`, `test_owner_resolution`, `test_path_suffix`, `test_resolution_evidence`, `test_sega_filing`, `test_shipped_content`, `test_twin_declarations`, `test_validated_choice`, `test_variant_choice`, `test_variant_identity`, `test_zipped_member` | | Verification, cross-reference and profile checks | synthetic + profiles | `test_bios_layout`, `test_cache_independent_counts`, `test_case_insensitive_platforms`, `test_checks_have_values`, `test_core_file_fills_declaration`, `test_core_size_refusal`, `test_cross_reference_sources`, `test_crypto_aes`, `test_crypto_unique_data`, `test_crypto_verify`, `test_entry_categories`, `test_file_consumers`, `test_fileless_audit`, `test_flycast_layout`, `test_gap_settlement`, `test_hidden_extras`, `test_launcher_aliases`, `test_launcher_layer`, `test_native_mode`, `test_no_case_collisions`, `test_path_conflict_status`, `test_path_null_copies`, `test_profile_checks`, `test_profile_names`, `test_profile_paths`, `test_profile_repositories`, `test_romm_hash_rule`, `test_shared_groups`, `test_standalone_links`, `test_standalone_mode`, `test_undeclared_dedup`, `test_unplaced_extras`, `test_validation_scope`, `test_verify_all_dir`, `test_verify_emulator_evidence`, `test_verify_listing`, `test_verify_pack_choice`, `test_verify_release_asset` | | Packs and manifests | synthetic + real packs | `test_artifact_lock`, `test_atomic_artifacts`, `test_batocera_cores`, `test_deterministic_zip`, `test_emulator_pack_counts`, `test_finalize_pack_names`, `test_large_file_cache`, `test_libretro_layout`, `test_manifest_entry`, `test_minui_platform`, `test_no_game_data`, `test_pack_conformance_dirs`, `test_pack_core_extras`, `test_pack_counts`, `test_pack_destinations`, `test_pack_failures`, `test_pack_file_names`, `test_pack_grouping`, `test_pack_integrity`, `test_pack_member_identity`, `test_pack_readme`, `test_platform_inheritance`, `test_platform_keys`, `test_release_packs`, `test_required_only_archives`, `test_required_only_twins`, `test_save_root`, `test_split_extras`, `test_split_names`, `test_split_pack`, `test_system_pack_extras`, `test_system_pack_parity`, `test_torrentzip`, `test_which_pack` | | Slots and regions | synthetic + profiles | `test_region`, `test_region_agnostic_scan`, `test_region_groups`, `test_region_held`, `test_region_platform_index`, `test_region_required_only`, `test_slot`, `test_slots`, `test_slots_shipped_file` |