@@ -190,6 +190,7 @@ def f():
190
190
history_cmd = captured_pane .stdout [- 2 ].strip ()
191
191
192
192
return assertCase (sent_cmd , history_cmd )
193
+
193
194
assert retry_until (f ), f"Unknown sent command: [{ sent_cmd } ] in { assertCase } "
194
195
195
196
@@ -329,6 +330,7 @@ def test_window_shell(session):
329
330
def f ():
330
331
session .server ._update_windows ()
331
332
return w ["window_name" ] != "top"
333
+
332
334
retry_until (f )
333
335
334
336
assert w .name != "top"
@@ -447,6 +449,7 @@ def test_start_directory(session, tmp_path: pathlib.Path):
447
449
448
450
for path , window in zip (dirs , session .windows ):
449
451
for p in window .panes :
452
+
450
453
def f ():
451
454
p .server ._update_panes ()
452
455
pane_path = p .current_path
@@ -497,6 +500,7 @@ def test_start_directory_relative(session, tmp_path: pathlib.Path):
497
500
498
501
for path , window in zip (dirs , session .windows ):
499
502
for p in window .panes :
503
+
500
504
def f ():
501
505
p .server ._update_panes ()
502
506
# Handle case where directories resolve to /private/ in OSX
@@ -558,6 +562,7 @@ def test_pane_order(session):
558
562
def f ():
559
563
p .server ._update_panes ()
560
564
return p .current_path == pane_path
565
+
561
566
retry_until (f )
562
567
563
568
assert p .current_path , pane_path
@@ -1014,17 +1019,20 @@ def test_load_workspace_enter(
1014
1019
builder = WorkspaceBuilder (sconf = sconfig , server = server )
1015
1020
builder .build ()
1016
1021
1017
- time .sleep (1 )
1018
-
1019
1022
session = builder .session
1020
1023
pane = session .attached_pane
1021
1024
1022
- captured_pane = "\n " .join (pane .capture_pane ())
1025
+ def fn ():
1026
+ captured_pane = "\n " .join (pane .capture_pane ())
1023
1027
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'
1028
1036
1029
1037
1030
1038
@pytest .mark .parametrize (
@@ -1038,12 +1046,12 @@ def test_load_workspace_enter(
1038
1046
- panes:
1039
1047
- shell_command:
1040
1048
- cmd: echo "___$((1 + 5))___"
1041
- sleep_before: 2
1049
+ sleep_before: .15
1042
1050
- cmd: echo "___$((1 + 3))___"
1043
- sleep_before: 1
1051
+ sleep_before: .35
1044
1052
"""
1045
1053
),
1046
- 1 .5 ,
1054
+ 0 .5 ,
1047
1055
"___4___" ,
1048
1056
],
1049
1057
[
@@ -1054,12 +1062,12 @@ def test_load_workspace_enter(
1054
1062
- panes:
1055
1063
- shell_command:
1056
1064
- cmd: echo "___$((1 + 5))___"
1057
- sleep_before: 2
1058
- - cmd: echo "___$((1 + 3))___"
1059
1065
sleep_before: 1
1066
+ - cmd: echo "___$((1 + 3))___"
1067
+ sleep_before: .25
1060
1068
"""
1061
1069
),
1062
- 3 ,
1070
+ 1.25 ,
1063
1071
"___4___" ,
1064
1072
],
1065
1073
[
@@ -1070,10 +1078,10 @@ def test_load_workspace_enter(
1070
1078
- panes:
1071
1079
- shell_command:
1072
1080
- cmd: echo "___$((1 + 3))___"
1073
- sleep_before: 2
1081
+ sleep_before: .5
1074
1082
"""
1075
1083
),
1076
- 2 ,
1084
+ 0.5 ,
1077
1085
"___4___" ,
1078
1086
],
1079
1087
[
@@ -1084,10 +1092,10 @@ def test_load_workspace_enter(
1084
1092
- panes:
1085
1093
- shell_command:
1086
1094
- cmd: echo "___$((1 + 3))___"
1087
- sleep_before: 2
1095
+ sleep_before: 1
1088
1096
"""
1089
1097
),
1090
- 2 ,
1098
+ 1 ,
1091
1099
"___4___" ,
1092
1100
],
1093
1101
[
@@ -1096,21 +1104,21 @@ def test_load_workspace_enter(
1096
1104
session_name: Should not execute
1097
1105
shell_command_before:
1098
1106
- cmd: echo "sleeping before"
1099
- sleep_before: 2
1107
+ sleep_before: .5
1100
1108
windows:
1101
1109
- panes:
1102
1110
- echo "___$((1 + 3))___"
1103
1111
"""
1104
1112
),
1105
- 2 ,
1113
+ 0.5 ,
1106
1114
"___4___" ,
1107
1115
],
1108
1116
],
1109
1117
ids = [
1110
- "command_level_sleep_3_shortform " ,
1111
- "command_level_pane_sleep_3_longform " ,
1112
- "pane_sleep_2_shortform " ,
1113
- "pane_sleep_2_longform " ,
1118
+ "command_level_sleep_shortform " ,
1119
+ "command_level_pane_sleep_longform " ,
1120
+ "pane_sleep_shortform " ,
1121
+ "pane_sleep_longform " ,
1114
1122
"shell_before_before_command_level" ,
1115
1123
],
1116
1124
)
0 commit comments