From 490ac91d65a63b74fe9a1bfc305cb026c477e908 Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Thu, 3 Dec 2026 19:21:58 -0600 Subject: [PATCH] sync(test[vt]): Await wrapped Git errors why: The loopback authentication test sees Git's diagnostic split across PTY rows. A physical-row wait misses that diagnostic. what: - Await the wrapped diagnostic via libvt's logical-line wait_for() matcher and verify it spans physical rows before checking the final screen golden. - Replace manual row-unwrapping loop with snap.unwrapped_text. Refs tmux-python/libvt#152 --- tests/sync/test_vt_subprocess.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/sync/test_vt_subprocess.py b/tests/sync/test_vt_subprocess.py index 07920aa65..c23e86b7a 100644 --- a/tests/sync/test_vt_subprocess.py +++ b/tests/sync/test_vt_subprocess.py @@ -444,6 +444,7 @@ def test_git_tty_401_error_screen_snapshot( """ ) + diagnostic = "terminal prompts disabled" short_parent = pathlib.Path("/tmp") with ( tempfile.TemporaryDirectory( @@ -471,6 +472,8 @@ async def _exercise() -> tuple[Snapshot, int, bool]: env=child_env, tty_mode="cooked", ) as pty: + diagnostic_snapshot = await pty.wait_for(diagnostic, timeout=3.0) + assert diagnostic not in diagnostic_snapshot.text snap = await pty.wait_for(lambda _s: pty.eof, timeout=3.0) rc = await asyncio.wait_for(pty.process.wait(), timeout=1.0) return snap, rc, pty.eof @@ -481,13 +484,11 @@ async def _exercise() -> tuple[Snapshot, int, bool]: (r"127\.0\.0\.1:\d+", "127.0.0.1:"), (clone_root, ""), ] - unwrapped_text = "".join( - snap[idx].text + ("" if snap[idx].wrapped else "\n") for idx in range(snap.rows) - ) + unwrapped_text = snap.unwrapped_text assert reached_eof is True assert returncode == 0, unwrapped_text assert snap.cursor.visible is True - assert "terminal prompts disabled" in unwrapped_text + assert diagnostic in unwrapped_text assert not any( line.startswith("Username for ") for line in unwrapped_text.splitlines() )