mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-18 15:47:51 -06:00
refactor: one emudeck script-to-profile rule
The target scraper kept its own copy of the EmuScripts table and took .ps1 files the platform scraper never read, so emudeck-we's template skeleton was published as a core and removed afterwards by an override. Both scrapers now read emulator_of_script, and the platform scraper lists the installers at the pinned revision, as launchers: and the SteamOS target already did. Targets rescraped, override dropped.
This commit is contained in:
1 parent
19898cb6ea
commit
5c93c6dc6b
9 files changed
+86
-61
No files matched your search
@@ -373,6 +373,8 @@ class Helpers(unittest.TestCase):
|
||||
self.assertEqual(el.emulator_of_script("emuDeckXemu.sh"), "xemu")
|
||||
self.assertIsNone(el.emulator_of_script("RetroArch_maincfg.sh"))
|
||||
self.assertIsNone(el.emulator_of_script("README.md"))
|
||||
self.assertEqual(el.emulator_of_script("emuDeckPCSX2QT.ps1"), "pcsx2")
|
||||
self.assertIsNone(el.emulator_of_script("emuDeckTemplate.ps1"))
|
||||
|
||||
def test_the_revision_comes_from_the_pinned_url(self):
|
||||
url = (
|
||||
|
||||
@@ -724,7 +724,7 @@ class UnreadableReleaseStopsTheScrape(unittest.TestCase):
|
||||
with mock.patch("urllib.request.urlopen", self._refuse), self.assertRaises(
|
||||
RuntimeError
|
||||
):
|
||||
emudeck_scraper.Scraper()._fetch_installed_emulators()
|
||||
emudeck_scraper.Scraper(checkbios_url="pinned")._fetch_installed_emulators("0" * 40)
|
||||
|
||||
def test_libretro_core_metadata_raises(self):
|
||||
"""libretro dropped every system name and manufacturer when the
|
||||
|
||||
@@ -541,6 +541,59 @@ class TargetsReadThePlatformRevision(unittest.TestCase):
|
||||
self.assertTrue(steamos)
|
||||
self.assertTrue(all(u.endswith(f"?ref={pin}") for u in steamos), steamos)
|
||||
|
||||
def test_emudeck_platform_lists_its_installers_at_the_pin(self):
|
||||
"""cores: was read on master while launchers: and the SteamOS target
|
||||
were read at the pin: the YAML described two revisions."""
|
||||
from scripts.scraper import emudeck_scraper
|
||||
|
||||
pin = "d" * 40
|
||||
seen: list[str] = []
|
||||
|
||||
class _Body:
|
||||
def __init__(self, url):
|
||||
seen.append(url)
|
||||
|
||||
def __enter__(self):
|
||||
return self
|
||||
|
||||
def __exit__(self, *_exc):
|
||||
return False
|
||||
|
||||
def read(self):
|
||||
return json.dumps([{"name": "emuDeckRMG.sh"}]).encode()
|
||||
|
||||
with mock.patch("urllib.request.urlopen", lambda req, **_kw: _Body(req.full_url)):
|
||||
cores = emudeck_scraper.Scraper(checkbios_url="pinned")._fetch_installed_emulators(pin)
|
||||
self.assertEqual(cores, ["mupen64plus_next"])
|
||||
self.assertEqual(len(seen), 1)
|
||||
self.assertTrue(seen[0].endswith(f"?ref={pin}"), seen)
|
||||
|
||||
|
||||
class EmuDeckScriptNamesHaveOneRule(unittest.TestCase):
|
||||
"""The target scraper kept its own copy of the EmuScripts-to-profile
|
||||
table: it published emudeck-we's template skeleton as a core, and a
|
||||
rename added to one copy only made --target filter that core out."""
|
||||
|
||||
def test_the_target_scraper_names_scripts_as_the_platform_does(self):
|
||||
from scripts.scraper.emudeck_launchers import emulator_of_script
|
||||
|
||||
listing = [
|
||||
"emuDeckRMG.sh",
|
||||
"emuDeckPCSX2QT.ps1",
|
||||
"emuDeckTemplate.ps1",
|
||||
"emuDeckRetroArch.ps1",
|
||||
"RetroArch_maincfg.sh",
|
||||
"emuDeckXemu.ps1",
|
||||
]
|
||||
scraper = emudeck_targets_scraper.Scraper(revision="0" * 40)
|
||||
with mock.patch.object(
|
||||
emudeck_targets_scraper, "_list_emuscripts", return_value=listing
|
||||
), mock.patch.object(scraper, "_load_retroarch_cores", return_value=["mgba"]):
|
||||
cores = scraper._fetch_cores_for_target("unused", "Windows")
|
||||
standalone = {emulator_of_script(name) for name in listing} - {None, "retroarch"}
|
||||
self.assertEqual(standalone, {"mupen64plus_next", "pcsx2", "xemu"})
|
||||
self.assertEqual(cores, sorted(standalone | {"mgba"}))
|
||||
|
||||
|
||||
class HashScrapersRefuseAnUnknownVersion(unittest.TestCase):
|
||||
"""mame_hash_scraper wrote core_version "unknown" after a failed API call
|
||||
|
||||
Reference in new issue
Block a user