Skip to content

Commit 511d97f

Browse files
committed
fix(tests[waiter]): replace fixed sleep with wait_for_pane_content
why: test_wait_for_pane_content_exact_match_detailed used time.sleep(0.1) to wait for content to appear after send_keys, but on tmux 3.6+ that interval is sometimes too short — leading to intermittent failures when capture_pane returned an empty pane and the subsequent assertion triggered. Surfaced by running the suite with --reruns=0. what: - replace time.sleep(0.1) with a wait_for_pane_content(CONTAINS) call that waits up to 2.0s for the unique test string to appear - this is deterministic and uses the very feature under test, so the test no longer relies on timing for setup
1 parent f16527e commit 511d97f

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

tests/_internal/test_waiter.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1852,8 +1852,15 @@ def test_wait_for_pane_content_exact_match_detailed(wait_pane: Pane) -> None:
18521852
# Send a unique string that we can test with an exact match
18531853
wait_pane.send_keys("UNIQUE_TEST_STRING_123", literal=True)
18541854

1855-
# Small delay to allow tmux to flush content (needed for older versions like 3.1b)
1856-
time.sleep(0.1)
1855+
# Wait deterministically for the string to appear in the pane
1856+
# rather than sleeping a fixed interval (flaky on slower tmux versions)
1857+
wait_for_pane_content(
1858+
wait_pane,
1859+
"UNIQUE_TEST_STRING_123",
1860+
ContentMatchType.CONTAINS,
1861+
timeout=2.0,
1862+
interval=0.05,
1863+
)
18571864

18581865
# Get the current content to work with
18591866
content = wait_pane.capture_pane()

0 commit comments

Comments
 (0)