fix: skip an unread zip index in verify --emulator

This commit is contained in:
Abdessamad Derraz committed 2026-10-17 13:29:29 +02:00
1 parent 8f0b992c11
commit 697eecfe80
2 files changed
+27 -3

No files matched your search

+8 -3
View File
@@ -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}
+19
View File
@@ -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()