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

+3 -3
View File
@@ -41,7 +41,7 @@ class _Inputs(unittest.TestCase):
class TheGivenDatabase(_Inputs):
def setUp(self) -> None:
tmp = Path(tempfile.mkdtemp(dir=REPO_ROOT / "tmp" if (REPO_ROOT / "tmp").is_dir() else None))
tmp = Path(tempfile.mkdtemp())
self.addCleanup(shutil.rmtree, tmp)
self.db = tmp / "database.json"
self.db.write_text(json.dumps({"files": {SHA1: {"path": "bios/X/only-here.bin"}}}))
@@ -58,7 +58,7 @@ class TheGivenDatabase(_Inputs):
class TheGivenProfilesAndPlatforms(_Inputs):
def setUp(self) -> None:
tmp = Path(tempfile.mkdtemp(dir=REPO_ROOT / "tmp" if (REPO_ROOT / "tmp").is_dir() else None))
tmp = Path(tempfile.mkdtemp())
self.addCleanup(shutil.rmtree, tmp)
self.emulators = tmp / "emulators"
self.emulators.mkdir()
@@ -103,7 +103,7 @@ class TheCollectionDoesNotDependOnTheWorkingDirectory(unittest.TestCase):
db = json.loads((REPO_ROOT / "database.json").read_text(encoding="utf-8"))
here = sitecollection.collection_paths(db)
places = sitecollection.copy_places(db)
elsewhere = Path(tempfile.mkdtemp(dir=REPO_ROOT / "tmp" if (REPO_ROOT / "tmp").is_dir() else None))
elsewhere = Path(tempfile.mkdtemp())
self.addCleanup(shutil.rmtree, elsewhere)
cwd = os.getcwd()
os.chdir(elsewhere)