@@ -190,6 +190,7 @@ def f():
190190 history_cmd = captured_pane .stdout [- 2 ].strip ()
191191
192192 return assertCase (sent_cmd , history_cmd )
193+
193194 assert retry_until (f ), f"Unknown sent command: [{ sent_cmd } ] in { assertCase } "
194195
195196
@@ -329,6 +330,7 @@ def test_window_shell(session):
329330 def f ():
330331 session .server ._update_windows ()
331332 return w ["window_name" ] != "top"
333+
332334 retry_until (f )
333335
334336 assert w .name != "top"
@@ -447,6 +449,7 @@ def test_start_directory(session, tmp_path: pathlib.Path):
447449
448450 for path , window in zip (dirs , session .windows ):
449451 for p in window .panes :
452+
450453 def f ():
451454 p .server ._update_panes ()
452455 pane_path = p .current_path
@@ -497,6 +500,7 @@ def test_start_directory_relative(session, tmp_path: pathlib.Path):
497500
498501 for path , window in zip (dirs , session .windows ):
499502 for p in window .panes :
503+
500504 def f ():
501505 p .server ._update_panes ()
502506 # Handle case where directories resolve to /private/ in OSX
@@ -558,6 +562,7 @@ def test_pane_order(session):
558562 def f ():
559563 p .server ._update_panes ()
560564 return p .current_path == pane_path
565+
561566 retry_until (f )
562567
563568 assert p .current_path , pane_path
@@ -1014,17 +1019,20 @@ def test_load_workspace_enter(
10141019 builder = WorkspaceBuilder (sconf = sconfig , server = server )
10151020 builder .build ()
10161021
1017- time .sleep (1 )
1018-
10191022 session = builder .session
10201023 pane = session .attached_pane
10211024
1022- captured_pane = "\n " .join (pane .capture_pane ())
1025+ def fn ():
1026+ captured_pane = "\n " .join (pane .capture_pane ())
10231027
1024- if should_see :
1025- assert output in captured_pane
1026- else :
1027- assert output not in captured_pane
1028+ if should_see :
1029+ return output in captured_pane
1030+ else :
1031+ return output not in captured_pane
1032+
1033+ assert retry_until (
1034+ fn , 1
1035+ ), f'Should{ " " if should_see else "not " } output in captured pane'
10281036
10291037
10301038@pytest .mark .parametrize (
0 commit comments