mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-30 13:28:51 -06:00
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:
1 parent
ec50bf6b41
commit
fbbb941e38
127 files changed
+665
-826
No files matched your search
@@ -10,6 +10,7 @@ full manifest.
|
||||
from __future__ import annotations
|
||||
|
||||
import tests
|
||||
from tests import scratch_dir
|
||||
|
||||
import contextlib
|
||||
import functools
|
||||
@@ -239,13 +240,8 @@ class InstallerLeavesGameDataOut(unittest.TestCase):
|
||||
"bios/game.wad": (b"wad" * 10, "game_data"),
|
||||
}
|
||||
|
||||
def _tempdir(self) -> Path:
|
||||
handle = tempfile.TemporaryDirectory()
|
||||
self.addCleanup(handle.cleanup)
|
||||
return Path(handle.name)
|
||||
|
||||
def serve(self, categorized: bool = True) -> None:
|
||||
root = self._tempdir()
|
||||
root = scratch_dir(self)
|
||||
files = []
|
||||
for path, (data, category) in self.FILES.items():
|
||||
(root / path).parent.mkdir(parents=True, exist_ok=True)
|
||||
@@ -272,7 +268,7 @@ class InstallerLeavesGameDataOut(unittest.TestCase):
|
||||
threading.Thread(target=httpd.serve_forever, daemon=True).start()
|
||||
self.addCleanup(httpd.server_close)
|
||||
self.addCleanup(httpd.shutdown)
|
||||
home = self._tempdir()
|
||||
home = scratch_dir(self)
|
||||
self.bios = home / "bios"
|
||||
self.bios.mkdir()
|
||||
self.env = {**os.environ, "HOME": str(home), "RETROBIOS_OS": "linux",
|
||||
|
||||
Reference in new issue
Block a user