mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-14 05:53:47 -06:00
fix: one failure line per file, tests stay local
This commit is contained in:
1 parent
2478c2a96c
commit
27bd4f1a50
8 files changed
+85
-23
No files matched your search
@@ -27,7 +27,9 @@ _SAVED: dict = {}
|
||||
|
||||
def _refuse(host: object) -> None:
|
||||
where = os.environ.get(NETLOG)
|
||||
if where:
|
||||
# A name under .invalid never resolves (RFC 2606): a test names one to
|
||||
# fail on purpose, refused here before its DNS query leaves.
|
||||
if where and not str(host).endswith(".invalid"):
|
||||
with open(where, "a", encoding="utf-8") as log:
|
||||
log.write(f"{os.getpid()} {host} {' '.join(sys.argv)[:300]}\n")
|
||||
raise OSError(errno.ENETUNREACH, f"a test makes no request to {host}")
|
||||
|
||||
+27
-6
@@ -10,6 +10,7 @@ import io
|
||||
import json
|
||||
import os
|
||||
import stat
|
||||
import select
|
||||
import shlex
|
||||
import re
|
||||
import shutil
|
||||
@@ -4182,17 +4183,35 @@ class AQuestionLeftWithCtrlDOrCtrlCIsAStop(unittest.TestCase):
|
||||
|
||||
home = Path(_tempdir(self))
|
||||
master, slave = pty.openpty()
|
||||
# Its output on the terminal too: piped, nothing is asked, and the
|
||||
# test skipped on every machine.
|
||||
proc = subprocess.Popen(
|
||||
[sys.executable, "install.py"], cwd=REPO_ROOT, stdin=slave,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True,
|
||||
env={**os.environ, "HOME": str(home), "RETROBIOS_OS": "linux"},
|
||||
[sys.executable, "install.py", "--plain"], cwd=REPO_ROOT, stdin=slave,
|
||||
stdout=slave, stderr=slave,
|
||||
# No request leaves the machine: the standalone emulators' lists
|
||||
# come from the network (code_audit_24 P3-13).
|
||||
env={**os.environ, "HOME": str(home), "RETROBIOS_OS": "linux",
|
||||
"RETROBIOS_INSTALL_OFFLINE": "1"},
|
||||
)
|
||||
os.close(slave)
|
||||
self.addCleanup(os.close, master)
|
||||
time.sleep(3)
|
||||
out = ""
|
||||
deadline = time.monotonic() + 60
|
||||
while "Which setup?" not in out and proc.poll() is None \
|
||||
and time.monotonic() < deadline:
|
||||
if select.select([master], [], [], 0.2)[0]:
|
||||
out += os.read(master, 65536).decode("utf-8", "replace")
|
||||
os.write(master, b"\x04")
|
||||
out, _ = proc.communicate(timeout=60)
|
||||
if "Choose the platform" not in out:
|
||||
proc.wait(timeout=60)
|
||||
while select.select([master], [], [], 0.2)[0]:
|
||||
try:
|
||||
chunk = os.read(master, 65536)
|
||||
except OSError:
|
||||
break
|
||||
if not chunk:
|
||||
break
|
||||
out += chunk.decode("utf-8", "replace")
|
||||
if "Which setup?" not in out:
|
||||
self.skipTest("a platform was detected on this machine")
|
||||
self.assertEqual(proc.returncode, 130, out)
|
||||
self.assertIn("Stopped", out)
|
||||
@@ -5211,6 +5230,8 @@ class EventsDescribeTheRun(unittest.TestCase, _SyntheticTree):
|
||||
# The systems Choose systems lists, before the files are read.
|
||||
{"event": "choices", "platform": "retroarch",
|
||||
"systems": ["sys-a", "sys-b", "other"]},
|
||||
# Nothing set aside before the choice (code_audit_24 P3-3).
|
||||
{"event": "set_aside", "platform": "retroarch", "dests": []},
|
||||
# a.bin and b.bin are in place: the first read and the last.
|
||||
{"event": "checking", "files_done": 1, "files_total": 2},
|
||||
{"event": "checking", "files_done": 2, "files_total": 2},
|
||||
|
||||
@@ -823,9 +823,16 @@ class Widgets(unittest.TestCase):
|
||||
state = fresh_state()
|
||||
press(state, "up")
|
||||
self.assertEqual(state.focus["setup"], 2)
|
||||
state = self.systems_state(20)
|
||||
state = fresh_state()
|
||||
state.stack = ["setup", "platforms"]
|
||||
press(state, "up")
|
||||
self.assertEqual(state.focus["systems"], 0)
|
||||
self.assertEqual(state.focus["platforms"], 0)
|
||||
# A list of ticks wraps at any length: None and Done, at its end,
|
||||
# are a few presses up from its first item (tui_audit_17 P3-1).
|
||||
state = self.systems_state(20)
|
||||
state.focus["systems"] = 0
|
||||
press(state, "up")
|
||||
self.assertEqual(install.tui_rows(state)[state.focus["systems"]].action, "done")
|
||||
|
||||
def test_filter_ignores_case_and_accents(self):
|
||||
state = self.systems_state(3)
|
||||
@@ -6777,7 +6784,12 @@ class AuditSevenScreens(unittest.TestCase):
|
||||
with SaveDirectoryRepository() as repo:
|
||||
argv = ["install.py", "--platform", "retroarch", "--dest", str(repo.dest),
|
||||
"--manifest", str(repo.root / "install" / "retroarch.json")]
|
||||
# The files come from the repository on the loopback: the module
|
||||
# read its base before the environment named it (code_audit_24
|
||||
# P3-13).
|
||||
served = repo.env()["RETROBIOS_BASE_URL"] + "/{path}"
|
||||
with mock.patch.dict(os.environ, repo.env()), \
|
||||
mock.patch.object(install, "RAW_FILE_URL", served), \
|
||||
mock.patch.object(sys, "argv", argv), \
|
||||
mock.patch.object(sys.stdin, "isatty", return_value=True), \
|
||||
mock.patch.object(install, "_is_terminal", return_value=True), \
|
||||
|
||||
Reference in new issue
Block a user