mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-23 10:07:48 -06:00
core: cli (run_cli, input errors, name hints), github (token), paths. model: sources, database, composition, registry, platforms, declarations, targets, systems, profiles, cliargs. resolve: content, ownership, datadirs, archives, localfile, directories, layout, contentlayout, standalone, grouping, cores. Definitions move verbatim; common.py and its re-exports are gone and every importer, patch target and code-in-string names the new home. A test that stubbed common.load_platform_config stubs each module that reads the loader by its own name.
49 lines
1.6 KiB
Python
49 lines
1.6 KiB
Python
"""One reverse index from upstream core names to profiles.
|
|
|
|
Five copies broke ties differently. The target branch of
|
|
resolve_platform_cores kept the last profile claiming a name, so the
|
|
buildbot's `pcsx2` (the LRPS2 core) mapped to the standalone pcsx2 profile
|
|
and a RetroArch target pack lost LRPS2's files.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import tests
|
|
|
|
import re
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
from model.profiles import preferred_profile, upstream_profile_index
|
|
from resolve.cores import resolve_platform_cores
|
|
|
|
REPO_ROOT = Path(__file__).resolve().parents[1]
|
|
|
|
PROFILES = {
|
|
"lrps2": {"type": "libretro", "cores": ["lrps2", "pcsx2"]},
|
|
"pcsx2": {"type": "standalone", "cores": ["pcsx2"]},
|
|
}
|
|
|
|
|
|
class OneIndex(unittest.TestCase):
|
|
def test_target_keeps_every_claimant(self):
|
|
config = {"cores": "all_libretro"}
|
|
self.assertEqual(
|
|
resolve_platform_cores(config, PROFILES, target_cores={"pcsx2"}), {"lrps2"}
|
|
)
|
|
|
|
def test_platform_list_prefers_the_key(self):
|
|
config = {"cores": ["pcsx2"]}
|
|
self.assertEqual(resolve_platform_cores(config, PROFILES), {"pcsx2"})
|
|
self.assertEqual(preferred_profile(upstream_profile_index(PROFILES), "pcsx2"), "pcsx2")
|
|
|
|
def test_no_hand_made_index(self):
|
|
pattern = re.compile(r"(upstream_to_profile|core_to_profile)\[[^\]]+\]\s*=")
|
|
for path in sorted((REPO_ROOT / "scripts").rglob("*.py")):
|
|
with self.subTest(module=path.name):
|
|
self.assertIsNone(pattern.search(path.read_text(encoding="utf-8")))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|