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 -8
View File
@@ -35,8 +35,7 @@ REPO_ROOT = Path(__file__).resolve().parents[1]
class ACoreFileFillsAFreeDeclaration(unittest.TestCase):
def setUp(self):
emulator_profiles_cache.clear()
(REPO_ROOT / "tmp").mkdir(exist_ok=True)
self.root = Path(tempfile.mkdtemp(dir=REPO_ROOT / "tmp"))
self.root = Path(tempfile.mkdtemp())
self.addCleanup(shutil.rmtree, self.root, True)
bios = self.root / "bios" / "Maker" / "Console"
bios.mkdir(parents=True)
@@ -105,7 +104,7 @@ class AFileDeclaredUnderAnotherName(unittest.TestCase):
def test_the_report_lists_what_the_builder_packs(self):
emulator_profiles_cache.clear()
root = Path(tempfile.mkdtemp(dir=REPO_ROOT / "tmp"))
root = Path(tempfile.mkdtemp())
self.addCleanup(shutil.rmtree, root, True)
bios = root / "bios" / "Apple" / "IIgs"
bios.mkdir(parents=True)
@@ -155,7 +154,7 @@ class AMissingDataDirectoryFailsTheRun(unittest.TestCase):
from packs import datatrees
from packs import platformpack
root = Path(tempfile.mkdtemp(dir=REPO_ROOT / "tmp"))
root = Path(tempfile.mkdtemp())
self.addCleanup(shutil.rmtree, root, True)
(root / "platforms").mkdir()
(root / "emulators").mkdir()
@@ -197,7 +196,7 @@ class AFileNobodyHoldsIsAnOmission(unittest.TestCase):
from packs.manifest import generate_manifest
emulator_profiles_cache.clear()
root = Path(tempfile.mkdtemp(dir=REPO_ROOT / "tmp"))
root = Path(tempfile.mkdtemp())
self.addCleanup(shutil.rmtree, root, True)
for folder in ("platforms", "emulators", "bios"):
(root / folder).mkdir()
@@ -238,7 +237,7 @@ class AMemberNameIsNotALooseFile(unittest.TestCase):
from packs import crossref
emulator_profiles_cache.clear()
root = Path(tempfile.mkdtemp(dir=REPO_ROOT / "tmp"))
root = Path(tempfile.mkdtemp())
self.addCleanup(shutil.rmtree, root, True)
(root / "platforms").mkdir()
(root / "emulators").mkdir()
@@ -272,7 +271,7 @@ class TwoDeclarationsOfOnePath(unittest.TestCase):
def _run(self, first: str, second: str, spelling: str):
emulator_profiles_cache.clear()
root = Path(tempfile.mkdtemp(dir=REPO_ROOT / "tmp"))
root = Path(tempfile.mkdtemp())
self.addCleanup(shutil.rmtree, root, True)
bios = root / "bios" / "Maker" / "Console"
bios.mkdir(parents=True)
@@ -323,7 +322,7 @@ class ANamelessWhitelistEntry(unittest.TestCase):
def test_the_pack_counts_what_verify_counts(self):
emulator_profiles_cache.clear()
root = Path(tempfile.mkdtemp(dir=REPO_ROOT / "tmp"))
root = Path(tempfile.mkdtemp())
self.addCleanup(shutil.rmtree, root, True)
bios = root / "bios" / "Sony" / "PlayStation"
bios.mkdir(parents=True)