mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-11 05:53:23 -05:00
40 lines
1.4 KiB
Python
40 lines
1.4 KiB
Python
"""--region decides among the files --required-only keeps.
|
|
|
|
The regional choice ran over optional candidates too. In Batocera's Vic20
|
|
group the optional Japanese kernel won for --region jp, the required PAL
|
|
and NTSC kernels were dropped as beaten, and --required-only then removed
|
|
the optional winner: the slot shipped empty.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
import unittest
|
|
from pathlib import Path
|
|
|
|
REPO_ROOT = Path(__file__).resolve().parents[1]
|
|
sys.path.insert(0, str(REPO_ROOT / "scripts"))
|
|
|
|
|
|
class RequiredOnlyBeforeRegion(unittest.TestCase):
|
|
def test_optional_files_leave_the_groups(self):
|
|
from packextras import platform_region_groups
|
|
|
|
systems = {"vic20": {"files": [
|
|
{"name": "kernel-ntsc.bin", "destination": "Vic20/kernel-ntsc.bin", "required": True},
|
|
{"name": "kernel-japanese.bin", "destination": "Vic20/kernel-japanese.bin",
|
|
"required": False},
|
|
]}}
|
|
groups, _ = platform_region_groups(
|
|
{}, systems, "emulators", None, "", {}, include_extras=False, required_only=True,
|
|
)
|
|
self.assertEqual(groups["vic20"], [("Vic20/kernel-ntsc.bin", "kernel-ntsc.bin")])
|
|
|
|
def test_every_caller_passes_it(self):
|
|
source = (REPO_ROOT / "scripts" / "generate_pack.py").read_text(encoding="utf-8")
|
|
self.assertEqual(source.count("required_only=required_only,\n )"), 2)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|