Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
tests(automatic_rename_option): Use retry_until()
  • Loading branch information
tony committed May 21, 2022
commit 23face22e44ca3c174177598f881076b23deff77
28 changes: 8 additions & 20 deletions tests/test_workspacebuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import libtmux
from libtmux import Window
from libtmux.common import has_gte_version
from libtmux.test import retry, temp_session
from libtmux.test import retry, retry_until, temp_session
from tmuxp import config, exc
from tmuxp.cli.load import load_plugins
from tmuxp.workspacebuilder import WorkspaceBuilder
Expand Down Expand Up @@ -386,36 +386,24 @@ def test_automatic_rename_option(session):
assert s.name != "tmuxp"
w = s.windows[0]

t = time.process_time()
while (time.process_time() - t) * 1000 < 20:
def check_window_name_mismatch() -> bool:
session.server._update_windows()
if w.name != portable_command:
break
time.sleep(0.2)
return w.name != portable_command

assert w.name != portable_command
assert retry_until(check_window_name_mismatch, 2, interval=0.25)

pane_base_index = w.show_window_option("pane-base-index", g=True)
w.select_pane(pane_base_index)

t = time.process_time()
while (time.process_time() - t) * 1000 < 20:
def check_window_name_match() -> bool:
session.server._update_windows()
if w.name == portable_command:
break
time.sleep(0.2)
return w.name == portable_command

assert w.name == portable_command
assert retry_until(check_window_name_match, 2, interval=0.25)

w.select_pane("-D")

t = time.process_time()
while (time.process_time() - t) * 1000 < 20:
session.server._update_windows()
if w["window_name"] != portable_command:
break
time.sleep(0.2)
assert w.name != portable_command
assert retry_until(check_window_name_mismatch, 2, interval=0.25)


def test_blank_pane_count(session):
Expand Down