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

+7 -7
View File
@@ -540,7 +540,7 @@ class FakeRepository:
self.selection = selection
def __enter__(self) -> FakeRepository:
self.root = Path(tempfile.mkdtemp(dir=REPO_ROOT / "tmp"))
self.root = Path(tempfile.mkdtemp())
(self.root / "install").mkdir()
(self.root / "bios").mkdir()
files = []
@@ -889,7 +889,7 @@ class InstallMatchesASystemPack(unittest.TestCase):
def _packed(self, systems, regions) -> set[str]:
import zipfile
with tempfile.TemporaryDirectory(dir=REPO_ROOT / "tmp") as out:
with tempfile.TemporaryDirectory() as out:
zip_path = platformpack.generate_pack(
self.PLATFORM, str(REPO_ROOT / "platforms"), self.db,
str(REPO_ROOT / "bios"), out,
@@ -929,7 +929,7 @@ class DataTreesFollowTheSystemsTheyServe(InstallMatchesASystemPack):
from model.registry import load_data_dir_registry
# The trees come from the registry the manifest reads by itself.
with tempfile.TemporaryDirectory(dir=REPO_ROOT / "tmp") as out:
with tempfile.TemporaryDirectory() as out:
zip_path = platformpack.generate_pack(
self.PLATFORM, str(REPO_ROOT / "platforms"), self.db,
str(REPO_ROOT / "bios"), out,
@@ -1056,7 +1056,7 @@ class AHeldFileTheInstallerCannotFetch(unittest.TestCase):
from model.platforms import _platform_config_cache
from model.profiles import emulator_profiles_cache
import generate_db
tmp = tempfile.TemporaryDirectory(dir=REPO_ROOT / "tmp")
tmp = tempfile.TemporaryDirectory()
self.addCleanup(tmp.cleanup)
previous = os.getcwd()
os.chdir(tmp.name)
@@ -1137,7 +1137,7 @@ class AStandaloneLayoutBelowTheBiosFolder(unittest.TestCase):
from model.platforms import _platform_config_cache
from model.profiles import emulator_profiles_cache
import generate_db
tmp = tempfile.TemporaryDirectory(dir=REPO_ROOT / "tmp")
tmp = tempfile.TemporaryDirectory()
self.addCleanup(tmp.cleanup)
previous = os.getcwd()
os.chdir(tmp.name)
@@ -1220,7 +1220,7 @@ class AnExtraBesideItsDeclarationBelowTheBiosFolder(unittest.TestCase):
from model.platforms import _platform_config_cache
from model.profiles import emulator_profiles_cache
import generate_db
tmp = tempfile.TemporaryDirectory(dir=REPO_ROOT / "tmp")
tmp = tempfile.TemporaryDirectory()
self.addCleanup(tmp.cleanup)
previous = os.getcwd()
os.chdir(tmp.name)
@@ -1434,7 +1434,7 @@ class ANativeNameSelectsOneSetEverywhere(unittest.TestCase):
import io
import zipfile
with tempfile.TemporaryDirectory(dir=REPO_ROOT / "tmp") as out, \
with tempfile.TemporaryDirectory() as out, \
contextlib.redirect_stdout(io.StringIO()):
zip_path = platformpack.generate_pack(
platform, str(REPO_ROOT / "platforms"), self.db,