mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-27 20:08:51 -06:00
refactor: return the md5 pack outcome as data
This commit is contained in:
1 parent
bbb139bbaf
commit
2b5955e8a5
4 files changed
+88
-58
No files matched your search
+11
-6
@@ -2871,7 +2871,7 @@ class TestE2E(unittest.TestCase):
|
||||
zip_contents=zip_contents,
|
||||
platform_name="testplat",
|
||||
platforms_dir=plat_dir,
|
||||
)
|
||||
).zip_path
|
||||
self.assertIsNotNone(zip_path)
|
||||
with zipfile.ZipFile(zip_path) as zf:
|
||||
names = zf.namelist()
|
||||
@@ -2896,7 +2896,7 @@ class TestE2E(unittest.TestCase):
|
||||
zip_contents=zip_contents,
|
||||
emulator_name="testplat",
|
||||
emulators_dir=emu_dir,
|
||||
)
|
||||
).zip_path
|
||||
self.assertIsNotNone(emu_zip)
|
||||
self.assertNotEqual(os.path.basename(emu_zip), os.path.basename(zip_path))
|
||||
self.assertTrue(os.path.exists(zip_path))
|
||||
@@ -2933,16 +2933,21 @@ class TestE2E(unittest.TestCase):
|
||||
os.makedirs(bios_dir)
|
||||
buf = io.StringIO()
|
||||
with contextlib.redirect_stdout(buf):
|
||||
result = generate_md5_pack(
|
||||
outcome = generate_md5_pack(
|
||||
hashes=[("md5", "md5known" + "0" * 25)],
|
||||
db=db,
|
||||
bios_dir=bios_dir,
|
||||
output_dir=out_dir,
|
||||
zip_contents={},
|
||||
)
|
||||
output = buf.getvalue()
|
||||
self.assertIn("NOT IN REPO", output)
|
||||
self.assertIsNone(result)
|
||||
self.assertEqual(buf.getvalue(), "")
|
||||
self.assertEqual(outcome.not_in_repo, [("missing.bin", "md5known" + "0" * 25)])
|
||||
self.assertEqual((outcome.packed, outcome.not_in_db), ([], []))
|
||||
self.assertIsNone(outcome.zip_path)
|
||||
from packs.packmodes import print_hash_pack
|
||||
with contextlib.redirect_stdout(buf):
|
||||
print_hash_pack(outcome)
|
||||
self.assertIn("NOT IN REPO: missing.bin", buf.getvalue())
|
||||
|
||||
def test_144_invalid_split_emulator(self):
|
||||
"""--split + --emulator is rejected."""
|
||||
|
||||
@@ -24,7 +24,12 @@ from core.cli import suggest_names
|
||||
from model.cliargs import list_system_ids
|
||||
from model.database import load_database
|
||||
from model.platforms import load_platform_config
|
||||
from model.profiles import emulator_profiles_cache, load_emulator_profiles, profiles_for_systems
|
||||
from model.profiles import (
|
||||
ProfileSelectionError,
|
||||
emulator_profiles_cache,
|
||||
load_emulator_profiles,
|
||||
profiles_for_systems,
|
||||
)
|
||||
from packs import archive
|
||||
from packs import emulatorpack
|
||||
from packs import md5pack
|
||||
@@ -77,11 +82,12 @@ class StandaloneNeedsAStandaloneBuild(unittest.TestCase):
|
||||
emulator_profiles_cache.clear()
|
||||
self.addCleanup(emulator_profiles_cache.clear)
|
||||
db = {"files": {}, "indexes": {"by_md5": {}, "by_crc32": {}, "by_name": {}}}
|
||||
result = md5pack.generate_md5_pack(
|
||||
[("md5", "d8f1206299c48946e6ec5ef96d014eaa")], db, tmp, tmp,
|
||||
emulator_name="handy", emulators_dir=str(Path(tmp, "emulators")), standalone=True,
|
||||
)
|
||||
self.assertIsNone(result)
|
||||
with self.assertRaisesRegex(ProfileSelectionError, "does not support --standalone"):
|
||||
md5pack.generate_md5_pack(
|
||||
[("md5", "d8f1206299c48946e6ec5ef96d014eaa")], db, tmp, tmp,
|
||||
emulator_name="handy", emulators_dir=str(Path(tmp, "emulators")),
|
||||
standalone=True,
|
||||
)
|
||||
self.assertEqual([p for p in os.listdir(tmp) if p.endswith(".zip")], [])
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user