Files
libretro/tests/test_libretro_slugs.py
T
Abdessamad Derraz 057fd2d0f6 fix: isolate every test module however it runs
tests/__init__.py keeps a run offline, its scratch under tmp/ and its
installer cache its own, but only discover -s tests -t . imported it.
discover tests ran with RETROBIOS_OFFLINE unset, scratch on the /tmp
tmpfs and the user's real installer cache, the setting in which e2e
fixtures had written into the shared .cache/large. Every test module now
imports the package first, and a test fails on a module that does not.
test_verify_listing.py took its line with the previous commit.
2026-11-06 15:14:05 +01:00

51 lines
1.8 KiB
Python

"""Scraped system ids are slugs the profiles know.
The libretro scraper filed System.dat's PC-8801, DSi and CD-i under
`nec---pc-8801`, `nintendo---nintendo-dsi` and `philips---cd-i`, fallback
slugs no profile declares. Target filtering kept the DSi BIOS in packs for
hardware without a DSi core, and PC-8801 survived only as a hand-added
duplicate system carrying the quasi88 group.
"""
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import sys
import unittest
from pathlib import Path
import yaml
REPO_ROOT = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(REPO_ROOT / "scripts"))
class ScrapedSystemIdsAreSlugs(unittest.TestCase):
def test_no_fallback_slug(self):
for path in sorted((REPO_ROOT / "platforms").glob("*.yml")):
data = yaml.safe_load(path.read_text(encoding="utf-8")) or {}
systems = data.get("systems") if isinstance(data, dict) else None
for sys_id in systems or {}:
with self.subTest(platform=path.stem, system=sys_id):
self.assertNotIn("---", str(sys_id))
def test_pc88_keeps_the_mk2sr_extension_set(self):
"""System.dat pairs the mkII SR main ROM with other models' extensions.
The quasi88 group supplies N88EXT0-3.ROM, which the core reads first
(src/LIBRETRO/libretro.c:109-112) and which match that main ROM.
"""
from common import load_platform_config
config = load_platform_config("retroarch", str(REPO_ROOT / "platforms"))
names = {
f.get("name") for f in config["systems"]["nec-pc-88"].get("files", [])
}
for name in ("N88EXT0.ROM", "N88EXT1.ROM", "N88EXT2.ROM", "N88EXT3.ROM"):
self.assertIn(name, names)
if __name__ == "__main__":
unittest.main()