Files
libretro/tests/test_agnostic_scan_mode.py
T
Abdessamad Derraz 83cfa6fd0f refactor: split common.py into three packages
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.
2026-11-18 11:09:13 +01:00

53 lines
1.8 KiB
Python

"""A filename-agnostic scan seeds only from the build the platform runs.
armsx2 declares bios_mode: agnostic, and its proverb.zip is a standalone
file the Android app fetches into its arcade/ folder. The scan never read
`mode:` and put it at system/proverb.zip in every pack running armsx2 as a
libretro core, while verify set the entry aside. Reads the repository.
"""
from __future__ import annotations
import tests
import os
import unittest
from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parents[1]
class ScanFollowsTheBuild(unittest.TestCase):
def test_no_standalone_seed_in_a_libretro_pack(self):
if not (REPO_ROOT / "database.json").exists():
self.skipTest("database.json is not built")
previous = os.getcwd()
os.chdir(REPO_ROOT)
self.addCleanup(os.chdir, previous)
from model.database import load_database
from model.profiles import load_emulator_profiles
from model.platforms import load_platform_config
from packextras import _collect_emulator_extras
profiles = load_emulator_profiles("emulators")
entry = next(
(f for f in profiles.get("armsx2", {}).get("files", [])
if f.get("name") == "proverb.zip"),
None,
)
if entry is None or entry.get("mode") != "standalone":
self.skipTest("armsx2 no longer declares a standalone proverb.zip")
config = load_platform_config("retroarch")
extras = _collect_emulator_extras(
config, "emulators", load_database("database.json"), set(),
config.get("base_destination", ""), profiles,
)
self.assertNotIn(
("proverb.zip", "ARMSX2"),
{(e["name"], e.get("source_emulator")) for e in extras},
)
if __name__ == "__main__":
unittest.main()