diff --git a/tests/test_launcher_evidence.py b/tests/test_launcher_evidence.py index 18dbe8074..57659fc80 100644 --- a/tests/test_launcher_evidence.py +++ b/tests/test_launcher_evidence.py @@ -35,14 +35,18 @@ from scraper.shell_launchers import ( # noqa: E402 config_ref, is_feature_ref, ) -from validate_schemas import ( # noqa: E402 - _config_reads_without_build, - _config_records_without_evidence, -) - REPO_ROOT = Path(__file__).resolve().parents[1] +def schema_checks(test: unittest.TestCase): + """validate_schemas, or a skip: it needs jsonschema, the build does not.""" + try: + import validate_schemas # noqa: PLC0415 + except ImportError as exc: + test.skipTest(f"validate_schemas needs jsonschema: {exc}") + return validate_schemas + + def record(**fields: object) -> dict: """A ROCKNIX-like DuckStation record citing its shipped settings.ini.""" base = { @@ -244,6 +248,7 @@ class StartScripts(unittest.TestCase): class Invariants(unittest.TestCase): def test_a_config_record_without_its_platform_links_is_an_error(self) -> None: + _config_records_without_evidence = schema_checks(self)._config_records_without_evidence path = REPO_ROOT / "platforms" / "x.yml" bare = {k: v for k, v in record().items() if k not in ("installs", "overrides")} listed = record(source_ref="gen.cs:3, es_features.yml:9") @@ -253,6 +258,7 @@ class Invariants(unittest.TestCase): self.assertIn("choices_from holds it", errors[1]) def test_reads_naming_a_platform_need_its_build(self) -> None: + _config_reads_without_build = schema_checks(self)._config_reads_without_build path = REPO_ROOT / "emulators" / "x.yml" reads = [{"file": "a.ini", "platforms": ["rocknix"], "source_ref": "a:1", "keys": []}] self.assertEqual(len(_config_reads_without_build(path, {"config_reads": reads})), 1) @@ -348,7 +354,7 @@ class BuildRefs(unittest.TestCase): def test_a_closed_build_is_read_in_its_binary(self) -> None: """An address ref is read in the binary binary_sha256 names, never - fetched; a source path cannot exist at a closed build.""" + fetched. A source path cannot exist at a closed build.""" read = { "file": "SSF.ini", "platforms": ["retrobat"], "binary_sha256": "e" * 64, "revision_from": "the archive", "source_ref": "SSF.exe 0x10-0x20", "keys": [], @@ -396,6 +402,7 @@ class RepositoryRecords(unittest.TestCase): ) def test_every_config_record_carries_its_platform_links(self) -> None: + _config_records_without_evidence = schema_checks(self)._config_records_without_evidence for path in sorted((REPO_ROOT / "platforms").glob("*.yml")): if path.name.startswith("_"): continue diff --git a/wiki/testing-guide.md b/wiki/testing-guide.md index 0b4948c50..c889b0305 100644 --- a/wiki/testing-guide.md +++ b/wiki/testing-guide.md @@ -55,7 +55,7 @@ Every module in `tests/`, by the area it guards. |------|----------|---------| | 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_build`, `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_proven_name`, `test_resolution_evidence`, `test_sega_filing`, `test_shipped_content`, `test_twin_declaration_status`, `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_content_checks`, `test_content_declarations`, `test_core_file_fills_declaration`, `test_core_size_refusal`, `test_cross_reference_sources`, `test_crypto_aes`, `test_crypto_unique_data`, `test_crypto_verify`, `test_data_only_refs`, `test_entry_categories`, `test_file_consumers`, `test_fileless_audit`, `test_flycast_layout`, `test_gap_settlement`, `test_hidden_extras`, `test_launcher_aliases`, `test_launcher_gaps`, `test_launcher_layer`, `test_launcher_paths`, `test_launcher_placement`, `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_data_dir_notice`, `test_verify_emulator_evidence`, `test_verify_listing`, `test_verify_pack_choice`, `test_verify_release_asset` | +| Verification, cross-reference and profile checks | synthetic + profiles | `test_bios_layout`, `test_cache_independent_counts`, `test_case_insensitive_platforms`, `test_checks_have_values`, `test_content_checks`, `test_content_declarations`, `test_core_file_fills_declaration`, `test_core_size_refusal`, `test_cross_reference_sources`, `test_crypto_aes`, `test_crypto_unique_data`, `test_crypto_verify`, `test_data_only_refs`, `test_entry_categories`, `test_file_consumers`, `test_fileless_audit`, `test_flycast_layout`, `test_gap_settlement`, `test_hidden_extras`, `test_launcher_aliases`, `test_launcher_evidence`, `test_launcher_gaps`, `test_launcher_layer`, `test_launcher_paths`, `test_launcher_placement`, `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_data_dir_notice`, `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_core_data_trees`, `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` | | Hardware targets and systems | synthetic + target files | `test_amberelec_targets`, `test_emuelec_targets`, `test_extract_targets`, `test_lakka_targets`, `test_libretro_slugs`, `test_system_ids`, `test_system_selection`, `test_target_names`, `test_target_scrapers`, `test_target_systems`, `test_target_verify` |