11
11
import libtmux
12
12
from libtmux import Window
13
13
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
15
15
from tmuxp import config , exc
16
16
from tmuxp .cli .load import load_plugins
17
17
from tmuxp .workspacebuilder import WorkspaceBuilder
@@ -359,6 +359,12 @@ def test_automatic_rename_option(session):
359
359
sconfig = kaptan .Kaptan (handler = "yaml" )
360
360
sconfig = sconfig .import_config (yaml_config ).get ()
361
361
362
+ # This should be a command guaranteed to be terminal name across systems
363
+ portable_command = sconfig ["windows" ][0 ]["panes" ][0 ]["shell_command" ][0 ]["cmd" ]
364
+ # If a command is like "man ls", get the command base name, "ls"
365
+ if " " in portable_command :
366
+ portable_command = portable_command .split (" " )[0 ]
367
+
362
368
builder = WorkspaceBuilder (sconf = sconfig )
363
369
364
370
window_count = len (session ._windows ) # current window count
@@ -380,31 +386,24 @@ def test_automatic_rename_option(session):
380
386
assert s .name != "tmuxp"
381
387
w = s .windows [0 ]
382
388
383
- while retry () :
389
+ def check_window_name_mismatch () -> bool :
384
390
session .server ._update_windows ()
385
- if w .name != "sh" :
386
- break
391
+ return w .name != portable_command
387
392
388
- assert w . name != "sh"
393
+ assert retry_until ( check_window_name_mismatch , 2 , interval = 0.25 )
389
394
390
395
pane_base_index = w .show_window_option ("pane-base-index" , g = True )
391
396
w .select_pane (pane_base_index )
392
397
393
- while retry () :
398
+ def check_window_name_match () -> bool :
394
399
session .server ._update_windows ()
395
- if w .name == "sh" :
396
- break
400
+ return w .name == portable_command
397
401
398
- assert w . name == "sh"
402
+ assert retry_until ( check_window_name_match , 2 , interval = 0.25 )
399
403
400
404
w .select_pane ("-D" )
401
405
402
- while retry ():
403
- session .server ._update_windows ()
404
- if w ["window_name" ] != "sh" :
405
- break
406
-
407
- assert w .name != "sh"
406
+ assert retry_until (check_window_name_mismatch , 2 , interval = 0.25 )
408
407
409
408
410
409
def test_blank_pane_count (session ):
0 commit comments