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 -5
View File
@@ -200,9 +200,7 @@ class AnEmptyExtractionKeepsTheCache(unittest.TestCase):
directory, recorded the version and reported success."""
def setUp(self):
scratch = Path(__file__).resolve().parent.parent / "tmp"
scratch.mkdir(exist_ok=True)
self.root = Path(tempfile.mkdtemp(dir=scratch))
self.root = Path(tempfile.mkdtemp())
self.addCleanup(shutil.rmtree, self.root, True)
self.cache = self.root / "cache"
self.cache.mkdir()
@@ -241,7 +239,7 @@ class TheVersionIsReadBeforeTheDownload(unittest.TestCase):
def test_a_build_published_during_the_download(self):
from packs import datadirs
root = Path(tempfile.mkdtemp(dir=REPO_ROOT / "tmp"))
root = Path(tempfile.mkdtemp())
self.addCleanup(shutil.rmtree, root, True)
state = {"downloaded": False}
@@ -266,7 +264,7 @@ class ABadResponseIsTriedAgain(unittest.TestCase):
failed the whole data step on it, and the next download was fine."""
def setUp(self) -> None:
root = Path(tempfile.mkdtemp(dir=REPO_ROOT / "tmp"))
root = Path(tempfile.mkdtemp())
self.addCleanup(shutil.rmtree, root, True)
self.versions = str(root / "versions.json")
self.entry = {"source_type": "zip", "source_url": "https://example.invalid/S.zip",