@@ -968,3 +968,71 @@ def test_load_workspace_enter(
968968 assert output in captured_pane
969969 else :
970970 assert output not in captured_pane
971+
972+
973+ @pytest .mark .parametrize (
974+ "yaml,output" ,
975+ [
976+ [
977+ textwrap .dedent (
978+ """
979+ session_name: Should not execute
980+ windows:
981+ - panes:
982+ - shell_command: echo "___$((1 + 3))___"
983+ sleep: 2
984+ """
985+ ),
986+ "___4___" ,
987+ ],
988+ [
989+ textwrap .dedent (
990+ """
991+ session_name: Should not execute
992+ windows:
993+ - panes:
994+ - shell_command:
995+ - echo "___$((1 + 3))___"
996+ sleep: 2
997+ """
998+ ),
999+ "___4___" ,
1000+ ],
1001+ ],
1002+ ids = [
1003+ "pane_sleep_3_shortform" ,
1004+ "pane_sleep_3_longform" ,
1005+ ],
1006+ )
1007+ def test_load_workspace_sleep (
1008+ tmp_path : pathlib .Path ,
1009+ server : libtmux .Server ,
1010+ monkeypatch : pytest .MonkeyPatch ,
1011+ yaml ,
1012+ output ,
1013+ ):
1014+ yaml_config = tmp_path / "simple.yaml"
1015+ yaml_config .write_text (
1016+ yaml ,
1017+ encoding = "utf-8" ,
1018+ )
1019+ sconfig = kaptan .Kaptan (handler = "yaml" )
1020+ sconfig = sconfig .import_config (str (yaml_config )).get ()
1021+ sconfig = config .expand (sconfig )
1022+ sconfig = config .trickle (sconfig )
1023+ builder = WorkspaceBuilder (sconf = sconfig , server = server )
1024+ builder .build ()
1025+
1026+ t = time .process_time ()
1027+
1028+ time .sleep (1 )
1029+ session = builder .session
1030+ pane = session .attached_pane
1031+
1032+ while (time .process_time () - t ) * 1000 < 2 :
1033+ captured_pane = "\n " .join (pane .capture_pane ())
1034+
1035+ assert output not in captured_pane
1036+ time .sleep (0.1 )
1037+ captured_pane = "\n " .join (pane .capture_pane ())
1038+ assert output in captured_pane
0 commit comments