|
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
|
@@ -386,36 +386,24 @@ def test_automatic_rename_option(session):
|
386 | 386 | assert s.name != "tmuxp"
|
387 | 387 | w = s.windows[0]
|
388 | 388 |
|
389 |
| - t = time.process_time() |
390 |
| - while (time.process_time() - t) * 1000 < 20: |
| 389 | + def check_window_name_mismatch() -> bool: |
391 | 390 | session.server._update_windows()
|
392 |
| - if w.name != portable_command: |
393 |
| - break |
394 |
| - time.sleep(0.2) |
| 391 | + return w.name != portable_command |
395 | 392 |
|
396 |
| - assert w.name != portable_command |
| 393 | + assert retry_until(check_window_name_mismatch, 2, interval=0.25) |
397 | 394 |
|
398 | 395 | pane_base_index = w.show_window_option("pane-base-index", g=True)
|
399 | 396 | w.select_pane(pane_base_index)
|
400 | 397 |
|
401 |
| - t = time.process_time() |
402 |
| - while (time.process_time() - t) * 1000 < 20: |
| 398 | + def check_window_name_match() -> bool: |
403 | 399 | session.server._update_windows()
|
404 |
| - if w.name == portable_command: |
405 |
| - break |
406 |
| - time.sleep(0.2) |
| 400 | + return w.name == portable_command |
407 | 401 |
|
408 |
| - assert w.name == portable_command |
| 402 | + assert retry_until(check_window_name_match, 2, interval=0.25) |
409 | 403 |
|
410 | 404 | w.select_pane("-D")
|
411 | 405 |
|
412 |
| - t = time.process_time() |
413 |
| - while (time.process_time() - t) * 1000 < 20: |
414 |
| - session.server._update_windows() |
415 |
| - if w["window_name"] != portable_command: |
416 |
| - break |
417 |
| - time.sleep(0.2) |
418 |
| - assert w.name != portable_command |
| 406 | + assert retry_until(check_window_name_mismatch, 2, interval=0.25) |
419 | 407 |
|
420 | 408 |
|
421 | 409 | def test_blank_pane_count(session):
|
|
0 commit comments