mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-29 12:58:51 -06:00
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.
This commit is contained in:
1 parent
ec50bf6b41
commit
fbbb941e38
127 files changed
+665
-826
No files matched your search
@@ -13,8 +13,10 @@ temporary directory instead of naming the missing parent.
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
os.environ.setdefault("RETROBIOS_OFFLINE", "1")
|
||||
@@ -53,3 +55,11 @@ os.environ["GIT_CEILING_DIRECTORIES"] = str(_SCRATCH)
|
||||
# The installer's cache (the games index, what reading a card found) is the
|
||||
# suite's own: a run never reads nor fills the one of the person running it.
|
||||
os.environ.setdefault("RETROBIOS_CACHE", str(_SCRATCH / "cache"))
|
||||
|
||||
|
||||
def scratch_dir(test: unittest.TestCase) -> Path:
|
||||
"""A fresh directory under this module's scratch folder, removed after
|
||||
the test."""
|
||||
path = Path(tempfile.mkdtemp())
|
||||
test.addCleanup(shutil.rmtree, path, True)
|
||||
return path
|
||||
Reference in new issue
Block a user