mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-17 17:03:27 -05:00
refactor: read the preferred-entry rule from packresolve
This commit is contained in:
1 parent
5f47b77112
commit
ccb35b9b82
2 files changed
+24
-1
No files matched your search
+3
-1
@@ -783,7 +783,9 @@ def _twin_index(
|
||||
verify_systems: dict, db: dict, base_dest: str, zip_contents: dict,
|
||||
) -> tuple[dict[str, int], dict[int, tuple[str, dict]]]:
|
||||
"""Which declaration the pack ships at each destination, and every declaration by id."""
|
||||
from generate_pack import _preferred_entries
|
||||
# From the module that defines the rule, not the builder's CLI: importing
|
||||
# generate_pack made every verify depend on its argparse and manifest code.
|
||||
from packresolve import preferred_entries as _preferred_entries
|
||||
|
||||
preferred_entries = _preferred_entries(
|
||||
verify_systems, db, DEFAULT_BIOS_DIR, base_dest, False,
|
||||
|
||||
@@ -2520,6 +2520,27 @@ class GeneratedModelsAreWrittenWhole(unittest.TestCase):
|
||||
self.assertTrue((bios / "Arcade" / "MAME" / "setclone.zip").exists())
|
||||
|
||||
|
||||
class APackNoteBesideItsSlotIsANote(unittest.TestCase):
|
||||
"""The builder writes INSTRUCTIONS_<name>.txt beside the slot it
|
||||
explains; verify_pack recognised notes at the ZIP root only and failed
|
||||
a pack holding games/keen6/INSTRUCTIONS_egagraph.ck6.txt."""
|
||||
|
||||
def test_a_nested_note_is_not_hashed_against_the_collection(self):
|
||||
from scripts.packverify import verify_pack
|
||||
|
||||
with tempfile.TemporaryDirectory(dir=TMP_ROOT) as directory:
|
||||
path = Path(directory) / "Pack.zip"
|
||||
with zipfile.ZipFile(path, "w") as archive:
|
||||
archive.writestr("games/keen6/INSTRUCTIONS_egagraph.ck6.txt", "File needed")
|
||||
archive.writestr("bios/RENAMED_x.bin.txt", "renamed")
|
||||
result = verify_pack(str(path), {"files": {}, "indexes": {}})
|
||||
self.assertTrue(result[0], result)
|
||||
|
||||
def test_verify_reads_the_rule_where_it_is_defined(self):
|
||||
source = (ROOT / "scripts" / "verify.py").read_text(encoding="utf-8")
|
||||
self.assertNotIn("from generate_pack import _preferred_entries", source)
|
||||
|
||||
|
||||
class TheDatabaseCacheIsWrittenWhole(unittest.TestCase):
|
||||
"""A crash while serializing left a truncated db_cache.json behind, and
|
||||
the next run rehashed the whole collection from scratch."""
|
||||
|
||||
Reference in new issue
Block a user