Skip to content

Commit 31ea6c3

Browse files
committed
tests: Example of retry() -> retry_until()
1 parent c768be0 commit 31ea6c3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/test_workspacebuilder.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import libtmux
1212
from libtmux import Window
1313
from libtmux.common import has_gte_version
14-
from libtmux.test import retry, temp_session
14+
from libtmux.test import retry, retry_until, temp_session
1515
from tmuxp import config, exc
1616
from tmuxp.cli.load import load_plugins
1717
from tmuxp.workspacebuilder import WorkspaceBuilder
@@ -102,13 +102,13 @@ def test_focus_pane_index(session):
102102

103103
pane_path = "/usr"
104104

105-
while retry():
105+
def pane_path_matches():
106106
p = w.attached_pane
107107
p.server._update_panes()
108108
if p.current_path == pane_path:
109-
break
109+
return True
110110

111-
assert p.current_path == pane_path
111+
assert retry_until(pane_path_matches, 2, interval=0.25, raises=False)
112112

113113
proc = session.cmd("show-option", "-gv", "base-index")
114114
base_index = int(proc.stdout[0])

0 commit comments

Comments
 (0)