Files
libretro/tests/test_verify_all_dir.py
T
Abdessamad Derraz fbbb941e38 refactor: one owner for the test scratch folder
Test modules passed dir= the repository's tmp/ or a hard-coded tmp/tests by hand, and seven modules kept their own _tempdir copy. Under run_tests.py the literal tmp/tests did not exist in a fresh clone (FileNotFoundError in test_core_probe and scratch_checkout), and dir=tmp/ wrote beside the per-module scratch folders. Every temporary directory now lands in the folder tests/__init__ sets, and scratch_dir() replaces the copies. The X socket binds by a relative name, since a scratch path can exceed the 108-byte AF_UNIX limit. The journeys keep the short tmp/ root: their word budgets count the printed card path.
2026-11-21 06:04:40 +01:00

45 lines
1.4 KiB
Python

"""``verify.py --all`` lists the platforms of ``--platforms-dir``.
The list came from ``platforms/`` whatever the flag said, while each config
was read from the flag's directory: a platform absent from the copy crashed
the run, and one registered only in the copy was never checked.
"""
from __future__ import annotations
import tests
import json
import subprocess
import sys
import tempfile
import unittest
from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parents[1]
class AllReadsTheGivenDirectory(unittest.TestCase):
def test_only_the_directory_platforms(self):
with tempfile.TemporaryDirectory() as tmp:
plat = Path(tmp)
(plat / "_registry.yml").write_text(
"platforms:\n solo:\n config: solo.yml\n"
)
(plat / "solo.yml").write_text(
"platform: Solo\nverification_mode: existence\n"
"base_destination: system\nsystems: {}\n"
)
run = subprocess.run(
[sys.executable, "scripts/verify.py", "--all",
"--platforms-dir", str(plat), "--json"],
cwd=REPO_ROOT, capture_output=True, text=True,
check=False,
)
self.assertEqual(run.returncode, 0, run.stderr[-2000:])
self.assertEqual(list(json.loads(run.stdout)), ["solo"])
if __name__ == "__main__":
unittest.main()