@@ -186,9 +186,6 @@ def test_wait_for_pane_content_timeout(wait_pane: Pane) -> None:
186
186
# Clear the pane to ensure test content isn't there
187
187
wait_pane .send_keys ("clear" , enter = True )
188
188
189
- # Make sure the clear command completed
190
- time .sleep (0.5 )
191
-
192
189
# Wait for content that will never appear, but don't raise exception
193
190
result = wait_for_pane_content (
194
191
wait_pane ,
@@ -255,9 +252,6 @@ def test_wait_until_pane_ready_error_handling(wait_pane: Pane) -> None:
255
252
wait_pane .send_keys ("clear" , enter = True )
256
253
wait_pane .send_keys ("echo 'test'" , enter = True )
257
254
258
- # Wait a bit for the command to complete
259
- time .sleep (0.5 )
260
-
261
255
# Should auto-detect shell prompt
262
256
result = wait_until_pane_ready (
263
257
wait_pane ,
@@ -276,9 +270,6 @@ def test_wait_until_pane_ready_with_invalid_prompt(wait_pane: Pane) -> None:
276
270
wait_pane .send_keys ("clear" , enter = True )
277
271
wait_pane .send_keys ("echo 'testing invalid prompt'" , enter = True )
278
272
279
- # Wait a bit for the command to complete
280
- time .sleep (0.5 )
281
-
282
273
# With an invalid prompt and raises=False, should not raise but return failure
283
274
result = wait_until_pane_ready (
284
275
wait_pane ,
@@ -341,7 +332,6 @@ def test_wait_for_window_panes(server: Server, session: Session) -> None:
341
332
342
333
# Split and create a second pane with delay
343
334
def split_pane () -> None :
344
- time .sleep (0.2 )
345
335
window .split ()
346
336
347
337
import threading
@@ -400,7 +390,6 @@ def test_wait_for_window_panes_count_range(session: Session) -> None:
400
390
401
391
# Split window to create a second pane
402
392
window .split ()
403
- time .sleep (0.5 )
404
393
405
394
# Should now have 2 panes
406
395
result = wait_for_window_panes (
@@ -430,7 +419,6 @@ def test_wait_for_any_content(wait_pane: Pane) -> None:
430
419
431
420
# Add content with delay
432
421
def add_content () -> None :
433
- time .sleep (0.2 )
434
422
wait_pane .send_keys (
435
423
"echo 'Success: Operation completed'" ,
436
424
enter = True ,
@@ -466,16 +454,13 @@ def add_content() -> None:
466
454
def test_wait_for_any_content_mixed_match_types (wait_pane : Pane ) -> None :
467
455
"""Test wait_for_any_content with different match types for each pattern."""
468
456
wait_pane .send_keys ("clear" , enter = True )
469
- time .sleep (0.5 )
470
457
471
458
# Create different patterns with different match types
472
459
wait_pane .send_keys ("echo 'test line one'" , enter = True )
473
460
wait_pane .send_keys ("echo 'number 123'" , enter = True )
474
461
wait_pane .send_keys ("echo 'exact match text'" , enter = True )
475
462
wait_pane .send_keys ("echo 'predicate target'" , enter = True )
476
463
477
- time .sleep (0.5 )
478
-
479
464
# Define a predicate function for testing
480
465
def has_predicate_text (lines : list [str ]) -> bool :
481
466
return any ("predicate target" in line for line in lines )
@@ -551,7 +536,6 @@ def test_wait_for_all_content(wait_pane: Pane) -> None:
551
536
wait_pane .send_keys ("clear" , enter = True ) # Ensure clean state
552
537
553
538
def add_content () -> None :
554
- time .sleep (0.2 )
555
539
wait_pane .send_keys (
556
540
"echo 'Database connected'; echo 'Server started'" ,
557
541
enter = True ,
@@ -591,11 +575,9 @@ def add_content() -> None:
591
575
def test_wait_for_all_content_no_raise (wait_pane : Pane ) -> None :
592
576
"""Test wait_for_all_content with raises=False."""
593
577
wait_pane .send_keys ("clear" , enter = True )
594
- time .sleep (0.5 )
595
578
596
579
# Add content that will be found
597
580
wait_pane .send_keys ("echo 'Found text'" , enter = True )
598
- time .sleep (0.5 )
599
581
600
582
# Look for one pattern that exists and one that doesn't
601
583
patterns : list [str | re .Pattern [str ] | Callable [[list [str ]], bool ]] = [
@@ -620,14 +602,11 @@ def test_wait_for_all_content_no_raise(wait_pane: Pane) -> None:
620
602
def test_wait_for_all_content_mixed_match_types (wait_pane : Pane ) -> None :
621
603
"""Test wait_for_all_content with different match types for each pattern."""
622
604
wait_pane .send_keys ("clear" , enter = True )
623
- time .sleep (0.5 )
624
605
625
606
# Add content that matches different patterns
626
607
wait_pane .send_keys ("echo 'contains test'" , enter = True )
627
608
wait_pane .send_keys ("echo 'number 456'" , enter = True )
628
609
629
- time .sleep (0.5 )
630
-
631
610
# Define different match types
632
611
match_types = [
633
612
ContentMatchType .CONTAINS , # For string match
@@ -686,15 +665,11 @@ def test_wait_for_all_content_type_error(wait_pane: Pane) -> None:
686
665
def test_wait_for_pane_content_exact_match (wait_pane : Pane ) -> None :
687
666
"""Test waiting for content with exact match."""
688
667
wait_pane .send_keys ("clear" , enter = True )
689
- time .sleep (0.5 ) # Wait for clear to take effect
690
668
691
669
# Add a line with a predictable content
692
670
test_content = "EXACT_MATCH_TEST_STRING"
693
671
wait_pane .send_keys (f"echo '{ test_content } '" , enter = True )
694
672
695
- # Wait for content to ensure it's present
696
- time .sleep (0.5 )
697
-
698
673
# Instead of trying exact match on a line (which is prone to shell prompt
699
674
# variations) Let's test if the content contains our string
700
675
result = wait_for_pane_content (
@@ -817,7 +792,6 @@ def test_pane_content_waiter_wait_for_exact_text(wait_pane: Pane) -> None:
817
792
"""Test PaneContentWaiter wait_for_exact_text method."""
818
793
wait_pane .send_keys ("clear" , enter = True )
819
794
wait_pane .send_keys ("echo 'Exact Test'" , enter = True )
820
- time .sleep (0.5 ) # Give time for the command to complete
821
795
822
796
# Use CONTAINS instead of EXACT for more reliable test
823
797
result = (
@@ -890,9 +864,7 @@ def test_expect_function_with_method_chaining(wait_pane: Pane) -> None:
890
864
"""Test expect function with method chaining."""
891
865
# Prepare content
892
866
wait_pane .send_keys ("clear" , enter = True )
893
- time .sleep (0.1 )
894
867
wait_pane .send_keys ("echo 'hello world'" , enter = True )
895
- time .sleep (0.1 )
896
868
897
869
# Test expect with method chaining
898
870
result = (
@@ -909,7 +881,6 @@ def test_expect_function_with_method_chaining(wait_pane: Pane) -> None:
909
881
910
882
# Test without_raising option
911
883
wait_pane .send_keys ("clear" , enter = True )
912
- time .sleep (0.1 )
913
884
914
885
result = (
915
886
expect (wait_pane )
@@ -926,13 +897,11 @@ def test_pane_content_waiter_with_line_range(wait_pane: Pane) -> None:
926
897
"""Test PaneContentWaiter with_line_range method."""
927
898
# Clear the pane first
928
899
wait_pane .send_keys ("clear" , enter = True )
929
- time .sleep (0.2 ) # Ensure the clear command completes
930
900
931
901
# Add some content
932
902
wait_pane .send_keys ("echo 'line1'" , enter = True )
933
903
wait_pane .send_keys ("echo 'line2'" , enter = True )
934
904
wait_pane .send_keys ("echo 'target-text'" , enter = True )
935
- time .sleep (0.2 ) # Wait for the commands to complete
936
905
937
906
# Test with specific line range - use a short timeout as we expect this
938
907
# to be found immediately
@@ -967,11 +936,9 @@ def test_pane_content_waiter_wait_until_ready(wait_pane: Pane) -> None:
967
936
"""Test PaneContentWaiter wait_until_ready method."""
968
937
# Clear the pane content first
969
938
wait_pane .send_keys ("clear" , enter = True )
970
- time .sleep (0.1 )
971
939
972
940
# Add a shell prompt
973
941
wait_pane .send_keys ("echo '$'" , enter = True )
974
- time .sleep (0.1 )
975
942
976
943
# Test wait_until_ready with specific prompt pattern
977
944
waiter = PaneContentWaiter (wait_pane ).with_timeout (1.0 )
@@ -985,11 +952,9 @@ def test_pane_content_waiter_with_invalid_line_range(wait_pane: Pane) -> None:
985
952
"""Test PaneContentWaiter with invalid line ranges."""
986
953
# Clear the pane first
987
954
wait_pane .send_keys ("clear" , enter = True )
988
- time .sleep (0.2 )
989
955
990
956
# Add some content to match
991
957
wait_pane .send_keys ("echo 'test content'" , enter = True )
992
- time .sleep (0.2 )
993
958
994
959
# Test with end < start - should use default range
995
960
waiter = (
@@ -1026,13 +991,11 @@ def test_wait_for_pane_content_regex_line_match(wait_pane: Pane) -> None:
1026
991
"""Test wait_for_pane_content with regex match and line detection."""
1027
992
# Clear the pane
1028
993
wait_pane .send_keys ("clear" , enter = True )
1029
- time .sleep (0.2 )
1030
994
1031
995
# Add multiple lines with patterns
1032
996
wait_pane .send_keys ("echo 'line 1 normal'" , enter = True )
1033
997
wait_pane .send_keys ("echo 'line 2 with pattern abc123'" , enter = True )
1034
998
wait_pane .send_keys ("echo 'line 3 normal'" , enter = True )
1035
- time .sleep (0.2 )
1036
999
1037
1000
# Create a regex pattern to find the line with the number pattern
1038
1001
pattern = re .compile (r"pattern [a-z0-9]+" )
@@ -1061,12 +1024,10 @@ def test_wait_for_all_content_with_line_range(wait_pane: Pane) -> None:
1061
1024
"""Test wait_for_all_content with line range specification."""
1062
1025
# Clear the pane first
1063
1026
wait_pane .send_keys ("clear" , enter = True )
1064
- time .sleep (0.2 ) # Ensure the clear command completes
1065
1027
1066
1028
# Add some content
1067
1029
wait_pane .send_keys ("echo 'Line 1'" , enter = True )
1068
1030
wait_pane .send_keys ("echo 'Line 2'" , enter = True )
1069
- time .sleep (0.2 ) # Wait for commands to complete
1070
1031
1071
1032
patterns : list [str | re .Pattern [str ] | Callable [[list [str ]], bool ]] = [
1072
1033
"Line 1" ,
@@ -1092,7 +1053,6 @@ def test_wait_for_all_content_timeout(wait_pane: Pane) -> None:
1092
1053
"""Test wait_for_all_content timeout behavior without raising exception."""
1093
1054
# Clear the pane first
1094
1055
wait_pane .send_keys ("clear" , enter = True )
1095
- time .sleep (0.2 ) # Ensure the clear command completes
1096
1056
1097
1057
# Pattern that won't be found in the pane content
1098
1058
patterns : list [str | re .Pattern [str ] | Callable [[list [str ]], bool ]] = [
@@ -1214,12 +1174,10 @@ def test_wait_for_any_content_with_predicates(wait_pane: Pane) -> None:
1214
1174
"""Test wait_for_any_content with predicate functions."""
1215
1175
# Clear and prepare pane
1216
1176
wait_pane .send_keys ("clear" , enter = True )
1217
- time .sleep (0.2 )
1218
1177
1219
1178
# Add some content
1220
1179
wait_pane .send_keys ("echo 'Line 1'" , enter = True )
1221
1180
wait_pane .send_keys ("echo 'Line 2'" , enter = True )
1222
- time .sleep (0.2 )
1223
1181
1224
1182
# Define two predicate functions, one that will match and one that won't
1225
1183
def has_two_lines (content : list [str ]) -> bool :
@@ -1248,12 +1206,10 @@ def test_wait_for_pane_content_with_line_range(wait_pane: Pane) -> None:
1248
1206
"""Test wait_for_pane_content with line range."""
1249
1207
# Clear and prepare pane
1250
1208
wait_pane .send_keys ("clear" , enter = True )
1251
- time .sleep (0.2 )
1252
1209
1253
1210
# Add numbered lines
1254
1211
for i in range (5 ):
1255
1212
wait_pane .send_keys (f"echo 'Line { i } '" , enter = True )
1256
- time .sleep (0.2 )
1257
1213
1258
1214
# Test with line range
1259
1215
result = wait_for_pane_content (
@@ -1458,7 +1414,6 @@ def test_wait_for_any_content_exact_match(wait_pane: Pane) -> None:
1458
1414
"""
1459
1415
# Clear the pane and add specific content
1460
1416
wait_pane .send_keys ("clear" , enter = True )
1461
- time .sleep (0.5 ) # Short delay to ensure clear happens
1462
1417
1463
1418
# Capture the current content to match it exactly later
1464
1419
content = wait_pane .capture_pane ()
@@ -1496,7 +1451,6 @@ def test_wait_for_any_content_string_regex(wait_pane: Pane) -> None:
1496
1451
"""
1497
1452
# Clear the pane
1498
1453
wait_pane .send_keys ("clear" , enter = True )
1499
- time .sleep (0.5 ) # Short delay to ensure clear happens
1500
1454
1501
1455
# Add content with patterns to match
1502
1456
wait_pane .send_keys ("Number ABC-123" , enter = True )
@@ -1519,12 +1473,9 @@ def test_wait_for_any_content_string_regex(wait_pane: Pane) -> None:
1519
1473
1520
1474
# Test focusing on just the string pattern for the next test
1521
1475
wait_pane .send_keys ("clear" , enter = True )
1522
- time .sleep (0.5 )
1523
1476
1524
1477
# Add only a string pattern match, ensuring it's the only match
1525
1478
wait_pane .send_keys ("Pattern XYZ-789" , enter = True )
1526
- # Wait a bit to make sure cmd is processed
1527
- time .sleep (0.5 )
1528
1479
1529
1480
# First check if the content has our pattern
1530
1481
content = wait_pane .capture_pane ()
@@ -1554,7 +1505,6 @@ def test_wait_for_all_content_predicate_match_numbering(wait_pane: Pane) -> None
1554
1505
"""
1555
1506
# Add some content to the pane
1556
1507
wait_pane .send_keys ("clear" , enter = True )
1557
- time .sleep (0.5 ) # Short delay to ensure clear happens
1558
1508
1559
1509
wait_pane .send_keys ("Predicate Line 1" , enter = True )
1560
1510
wait_pane .send_keys ("Predicate Line 2" , enter = True )
@@ -1891,11 +1841,9 @@ def test_wait_for_pane_content_exact_match_detailed(wait_pane: Pane) -> None:
1891
1841
"""
1892
1842
# Clear the pane first to have more predictable content
1893
1843
wait_pane .clear ()
1894
- time .sleep (0.3 ) # Give time for clear to take effect
1895
1844
1896
1845
# Send a unique string that we can test with an exact match
1897
1846
wait_pane .send_keys ("UNIQUE_TEST_STRING_123" , literal = True )
1898
- time .sleep (0.3 ) # Give more time for content to appear
1899
1847
1900
1848
# Get the current content to work with
1901
1849
content = wait_pane .capture_pane ()
@@ -1952,9 +1900,6 @@ def test_wait_for_pane_content_with_invalid_prompt(wait_pane: Pane) -> None:
1952
1900
wait_pane .send_keys ("clear" , enter = True )
1953
1901
wait_pane .send_keys ("echo 'testing invalid prompt'" , enter = True )
1954
1902
1955
- # Wait a bit for the command to complete
1956
- time .sleep (0.5 )
1957
-
1958
1903
# With a non-matching pattern and raises=False, should not raise but return failure
1959
1904
result = wait_for_pane_content (
1960
1905
wait_pane ,
0 commit comments