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:
Abdessamad Derraz committed 2026-11-21 06:04:40 +01:00
1 parent ec50bf6b41
commit fbbb941e38
127 files changed
+665 -826

No files matched your search

+2 -3
View File
@@ -22,7 +22,7 @@ REPO_ROOT = Path(__file__).resolve().parent.parent
def _pack(*options: str) -> tuple[subprocess.CompletedProcess, list[str]]:
with tempfile.TemporaryDirectory(dir=REPO_ROOT / "tmp") as out:
with tempfile.TemporaryDirectory() as out:
proc = subprocess.run(
[sys.executable, "scripts/generate_pack.py", *options, "--offline",
"--output-dir", out],
@@ -41,7 +41,6 @@ class TheEmulatorContextIsChecked(unittest.TestCase):
db_path = REPO_ROOT / "database.json"
if not db_path.exists():
raise unittest.SkipTest("database.json is not built")
(REPO_ROOT / "tmp").mkdir(exist_ok=True)
cls.db = json.loads(db_path.read_text(encoding="utf-8"))
def test_an_unknown_emulator_is_refused(self):
@@ -79,7 +78,7 @@ class SystemAndEmulatorPacksKeepTheirNames(unittest.TestCase):
import generate_db
from packs import emulatorpack
with tempfile.TemporaryDirectory(dir=REPO_ROOT / "tmp") as directory:
with tempfile.TemporaryDirectory() as directory:
root = Path(directory)
(root / "bios").mkdir()
(root / "emulators").mkdir()