Files
libretro/tests/test_flycast_layout.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

34 lines
1.2 KiB
Python

"""Flycast's two builds read the same files from two directories.
The libretro port looks in <system>/dc/ (shell/libretro/libretro.cpp:2249-2250).
The standalone emulator looks in its data directory, whose root holds the
files with no dc/ level (core/oslib/oslib.cpp:118-196, core/stdclass.cpp:95-125).
Without standalone_path the standalone layout of a pack fell back on path:
and put every file one directory too deep.
"""
from __future__ import annotations
import tests # noqa: F401 offline, scratch under tmp/, the suite's own cache
import unittest
from pathlib import Path
import yaml
PROFILE = Path(__file__).resolve().parent.parent / "emulators" / "flycast.yml"
class FlycastStandaloneLayout(unittest.TestCase):
def test_every_entry_has_the_data_directory_layout(self) -> None:
profile = yaml.safe_load(PROFILE.read_text(encoding="utf-8"))
self.assertEqual(profile["type"], "standalone + libretro")
for entry in profile["files"]:
with self.subTest(entry=entry["name"]):
self.assertTrue(entry["path"].startswith("dc/"))
self.assertEqual(entry.get("standalone_path"), entry["path"][len("dc/"):])
if __name__ == "__main__":
unittest.main()