Fix test again.

This commit is contained in:
Nicholas Marriott
2026-10-07 06:46:25 +01:00
parent 4775bc95e1
commit 209d389a81

View File

@@ -68,7 +68,9 @@ def wait_file(path, length, timeout=5):
time.sleep(0.05) time.sleep(0.05)
return b"" return b""
def respawn(command): def respawn(command, output):
with open(output, "wb"):
pass
run("respawn-window", "-k", "-t", "requests:0", command) run("respawn-window", "-k", "-t", "requests:0", command)
def wait_pane(expected, context): def wait_pane(expected, context):
@@ -123,7 +125,7 @@ try:
respawn("stty raw -echo min 1 time 50; " respawn("stty raw -echo min 1 time 50; "
"printf '%s'; dd bs=1 count=%d 2>/dev/null >%s; " "printf '%s'; dd bs=1 count=%d 2>/dev/null >%s; "
"exec cat -v" % "exec cat -v" %
(query, len(expected), shlex.quote(output))) (query, len(expected), shlex.quote(output)), output)
data = read_until(fd, needle) data = read_until(fd, needle)
assert b"?" in data, (context, "query missing", data) assert b"?" in data, (context, "query missing", data)
@@ -181,7 +183,7 @@ try:
respawn("stty raw -echo min 1 time 50; " respawn("stty raw -echo min 1 time 50; "
"printf '\\033]%d;?\\033\\\\'; " "printf '\\033]%d;?\\033\\\\'; "
"dd bs=1 count=%d 2>/dev/null >%s; exec cat -v" % "dd bs=1 count=%d 2>/dev/null >%s; exec cat -v" %
(colour, len(expected), shlex.quote(output))) (colour, len(expected), shlex.quote(output)), output)
got = wait_file(output, len(expected)) got = wait_file(output, len(expected))
assert got == expected, (context, "colour not applied", got) assert got == expected, (context, "colour not applied", got)
os.write(fd, b"Z") os.write(fd, b"Z")