mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-28 04:18:52 -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
@@ -35,7 +35,6 @@ from scraper.base_scraper import (
|
||||
)
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parent.parent
|
||||
TMP_ROOT = REPO_ROOT / "tmp"
|
||||
SHA = "0123456789abcdef0123456789abcdef01234567"
|
||||
|
||||
|
||||
@@ -143,7 +142,7 @@ class SourceRevisionReadsEveryShape(unittest.TestCase):
|
||||
self.assertEqual(scraped_revision(Path(tmp, "absent.yml")), "")
|
||||
|
||||
def test_a_platform_without_a_revision_raises(self):
|
||||
with tempfile.TemporaryDirectory(dir=TMP_ROOT) as tmp:
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
path = Path(tmp, "p.yml")
|
||||
path.write_text("source: https://github.com/emulatorjs/emulatorjs\n")
|
||||
with self.assertRaises(RuntimeError):
|
||||
@@ -232,7 +231,7 @@ class GitHubAnswers(unittest.TestCase):
|
||||
|
||||
class Downloads(unittest.TestCase):
|
||||
def test_written_whole_with_its_disposition(self):
|
||||
with tempfile.TemporaryDirectory(dir=TMP_ROOT) as tmp:
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
target = Path(tmp, "sub", "a.zip")
|
||||
with mock.patch("urllib.request.urlopen", _answer(503, b"payload")), \
|
||||
mock.patch("time.sleep"):
|
||||
@@ -242,7 +241,7 @@ class Downloads(unittest.TestCase):
|
||||
self.assertEqual(sorted(p.name for p in target.parent.iterdir()), ["a.zip"])
|
||||
|
||||
def test_a_failure_leaves_nothing(self):
|
||||
with tempfile.TemporaryDirectory(dir=TMP_ROOT) as tmp:
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
target = Path(tmp, "a.zip")
|
||||
with mock.patch("urllib.request.urlopen", _answer(403)), \
|
||||
self.assertRaises(FetchError):
|
||||
@@ -250,7 +249,7 @@ class Downloads(unittest.TestCase):
|
||||
self.assertEqual(list(Path(tmp).iterdir()), [])
|
||||
|
||||
def test_an_existing_file_is_kept_when_asked(self):
|
||||
with tempfile.TemporaryDirectory(dir=TMP_ROOT) as tmp:
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
target = Path(tmp, "a.zip")
|
||||
target.write_bytes(b"cached")
|
||||
with mock.patch("urllib.request.urlopen", _answer(403)):
|
||||
|
||||
Reference in new issue
Block a user