From 697eecfe8090d8987d08ae27f19a2741a7e726e3 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Sat, 17 Oct 2026 13:29:24 +0200 Subject: [PATCH] fix: skip an unread zip index in verify --emulator --- scripts/verify.py | 11 ++++++++--- tests/test_system_selection.py | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/scripts/verify.py b/scripts/verify.py index 31d283f1..f03f502f 100644 --- a/scripts/verify.py +++ b/scripts/verify.py @@ -1450,13 +1450,18 @@ def verify_emulator( placement_block, ) - load_emulator_profiles(emulators_dir) - zip_contents = build_zip_contents_index(db) - # Also load aliases for redirect messages all_profiles = load_emulator_profiles(emulators_dir, skip_aliases=False) selected = _select_profiles(profile_names, all_profiles, standalone) + # The member index only answers a zipped_file entry, and decompressing + # every archive took 23 of the 24 seconds of a run that had none. + zip_contents = ( + build_zip_contents_index(db) + if any(f.get("zipped_file") for _name, profile in selected + for f in profile.get("files") or []) + else {} + ) # Build validation index from selected profiles only selected_profiles = {n: p for n, p in selected} diff --git a/tests/test_system_selection.py b/tests/test_system_selection.py index 6a7fa0df..1f68c935 100644 --- a/tests/test_system_selection.py +++ b/tests/test_system_selection.py @@ -178,5 +178,24 @@ class ATypoGetsTheNearestNames(unittest.TestCase): self.assertEqual(common.suggest_names(["zzz"], many, "--list-systems"), "--list-systems lists all 40.") + +class EmulatorVerifyReadsNoArchiveItDoesNotNeed(unittest.TestCase): + """verify --emulator decompressed every archive of the collection to + index ZIP members, for zipped_file entries no profile declares: 23 of + the 24 seconds of a run.""" + + def test_the_member_index_is_not_built(self): + from unittest import mock # noqa: PLC0415 + + import verify # noqa: PLC0415 + + if not (REPO_ROOT / "database.json").exists(): + self.skipTest("database.json is not generated") + db = common.load_database(str(REPO_ROOT / "database.json")) + with mock.patch.object(verify, "build_zip_contents_index", + side_effect=AssertionError("index built")): + result = verify.verify_emulator(["handy"], str(REPO_ROOT / "emulators"), db) + self.assertTrue(result) + if __name__ == "__main__": unittest.main()