mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-23 01:57:48 -06:00
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.
69 lines
2.2 KiB
Python
69 lines
2.2 KiB
Python
"""A platform whose pack or manifest raised fails the run.
|
|
|
|
Both loops printed ERROR and moved on. The exit code came from the packs
|
|
present on disk, so a pack never written, or a manifest install.py would
|
|
keep serving from an older run, left the run green.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import tests
|
|
|
|
import argparse
|
|
import os
|
|
import tempfile
|
|
import unittest
|
|
from pathlib import Path
|
|
from unittest import mock
|
|
|
|
import generate_pack as gp
|
|
from packs import manifest
|
|
from packs import platformpack
|
|
|
|
REPO_ROOT = Path(__file__).resolve().parents[1]
|
|
|
|
|
|
def _boom(*args, **kwargs):
|
|
raise OSError(28, "No space left on device")
|
|
|
|
|
|
class FailedPlatformFailsTheRun(unittest.TestCase):
|
|
def setUp(self):
|
|
previous = os.getcwd()
|
|
os.chdir(REPO_ROOT)
|
|
self.addCleanup(os.chdir, previous)
|
|
self.tmp = tempfile.TemporaryDirectory()
|
|
self.addCleanup(self.tmp.cleanup)
|
|
|
|
def _args(self) -> argparse.Namespace:
|
|
return argparse.Namespace(
|
|
all_variants=False, source="full", required_only=False,
|
|
platforms_dir="platforms", target=None, split=False,
|
|
emulators_dir="emulators", regions=[],
|
|
one_per_slot=False, offline=True, bios_dir="bios",
|
|
output_dir=self.tmp.name, verify_packs=False,
|
|
)
|
|
|
|
def test_pack_mode(self):
|
|
with mock.patch.object(gp, "generate_pack", _boom), \
|
|
mock.patch.object(platformpack, "generate_pack", _boom), \
|
|
mock.patch.object(gp, "verify_and_finalize_packs", return_value=True), \
|
|
self.assertRaises(SystemExit) as ctx:
|
|
gp._run_platform_packs(
|
|
self._args(), [(["retropie"], "retropie")], {}, {}, {}, {}, {}, None
|
|
)
|
|
self.assertEqual(ctx.exception.code, 1)
|
|
|
|
def test_manifest_mode(self):
|
|
with mock.patch.object(gp, "generate_manifest", _boom), \
|
|
mock.patch.object(manifest, "generate_manifest", _boom), \
|
|
self.assertRaises(SystemExit) as ctx:
|
|
gp._run_manifest_mode(
|
|
self._args(), [(["retropie"], "retropie")], {}, {}, {}, {}
|
|
)
|
|
self.assertEqual(ctx.exception.code, 1)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|