Files
libretro/tests/test_undeclared_dedup.py
T
Abdessamad Derraz 5f18caec31 refactor: put scripts/ on the test path once
tests/__init__ now puts the repository root and scripts/ on sys.path,
so no test module inserts them and every import sits in the import
block. ruff accepts the bare `import tests` the modules keep for its
side effects. The last suppressions go: helper test modules import as
tests.<name>, files open in with blocks, lambdas become functions.
2026-11-17 16:11:23 +01:00

41 lines
1.4 KiB
Python

"""Same-named core files at two paths stay two files in standalone mode.
find_undeclared_files keyed its dedup on standalone_path alone when the
platform runs the core standalone, while the destination it then writes
falls back on path. Batocera runs clk standalone, clk declares basic.rom
under Acorn/ and Electron/ without a standalone_path, and the second was
dropped from the pack.
"""
from __future__ import annotations
import tests
import unittest
class StandaloneFallsBackOnPath(unittest.TestCase):
def test_both_paths_survive(self):
from verify import find_undeclared_files
profile = {
"emulator": "Clock Signal",
"type": "standalone + libretro",
"systems": ["acorn-electron"],
"files": [
{"name": "basic.rom", "path": "Acorn/basic.rom", "required": True},
{"name": "basic.rom", "path": "Electron/basic.rom", "required": True},
],
}
config = {"cores": ["clk"], "standalone_cores": ["clk"], "systems": {}}
db = {"files": {}, "indexes": {}}
found = find_undeclared_files(config, "emulators", db, emu_profiles={"clk": profile})
self.assertEqual(
sorted(f["path"] for f in found if f["name"] == "basic.rom"),
["Acorn/basic.rom", "Electron/basic.rom"],
)
if __name__ == "__main__":
unittest.main()