@@ -1099,131 +1099,143 @@ def test_find_current_active_pane(
10991099 assert builder .find_current_attached_session () == second_session
11001100
11011101
1102- @pytest .mark .parametrize (
1103- ("yaml" , "output" , "should_see" ),
1104- [
1105- (
1106- textwrap .dedent (
1107- """
1102+ class WorkspaceEnterFixture (t .NamedTuple ):
1103+ """Test fixture for workspace enter behavior verification."""
1104+
1105+ test_id : str
1106+ yaml : str
1107+ output : str
1108+ should_see : bool
1109+
1110+
1111+ WORKSPACE_ENTER_FIXTURES : list [WorkspaceEnterFixture ] = [
1112+ WorkspaceEnterFixture (
1113+ test_id = "pane_enter_false_shortform" ,
1114+ yaml = textwrap .dedent (
1115+ """
11081116session_name: Should not execute
11091117windows:
11101118- panes:
11111119 - shell_command: echo "___$((1 + 3))___"
11121120 enter: false
11131121 """ ,
1114- ),
1115- "___4___" ,
1116- False ,
11171122 ),
1118- (
1119- textwrap .dedent (
1120- """
1123+ output = "___4___" ,
1124+ should_see = False ,
1125+ ),
1126+ WorkspaceEnterFixture (
1127+ test_id = "pane_enter_false_longform" ,
1128+ yaml = textwrap .dedent (
1129+ """
11211130session_name: Should not execute
11221131windows:
11231132- panes:
11241133 - shell_command:
11251134 - echo "___$((1 + 3))___"
11261135 enter: false
11271136 """ ,
1128- ),
1129- "___4___" ,
1130- False ,
11311137 ),
1132- (
1133- textwrap .dedent (
1134- """
1138+ output = "___4___" ,
1139+ should_see = False ,
1140+ ),
1141+ WorkspaceEnterFixture (
1142+ test_id = "pane_enter_default_shortform" ,
1143+ yaml = textwrap .dedent (
1144+ """
11351145session_name: Should execute
11361146windows:
11371147- panes:
11381148 - shell_command: echo "___$((1 + 3))___"
11391149 """ ,
1140- ),
1141- "___4___" ,
1142- True ,
11431150 ),
1144- (
1145- textwrap .dedent (
1146- """
1151+ output = "___4___" ,
1152+ should_see = True ,
1153+ ),
1154+ WorkspaceEnterFixture (
1155+ test_id = "pane_enter_default_longform" ,
1156+ yaml = textwrap .dedent (
1157+ """
11471158session_name: Should execute
11481159windows:
11491160- panes:
11501161 - shell_command:
11511162 - echo "___$((1 + 3))___"
11521163 """ ,
1153- ),
1154- "___4___" ,
1155- True ,
11561164 ),
1157- (
1158- textwrap .dedent (
1159- """
1165+ output = "___4___" ,
1166+ should_see = True ,
1167+ ),
1168+ WorkspaceEnterFixture (
1169+ test_id = "pane_command_enter_false_shortform" ,
1170+ yaml = textwrap .dedent (
1171+ """
11601172session_name: Should not execute
11611173windows:
11621174- panes:
11631175 - shell_command:
11641176 - cmd: echo "___$((1 + 3))___"
11651177 enter: false
11661178 """ ,
1167- ),
1168- "___4___" ,
1169- False ,
11701179 ),
1171- ( # NOQA: PT014 RUF100
1172- textwrap .dedent (
1173- """
1180+ output = "___4___" ,
1181+ should_see = False ,
1182+ ),
1183+ WorkspaceEnterFixture ( # NOQA: PT014 RUF100
1184+ test_id = "pane_command_enter_false_longform" ,
1185+ yaml = textwrap .dedent (
1186+ """
11741187session_name: Should not execute
11751188windows:
11761189- panes:
11771190 - shell_command:
11781191 - cmd: echo "___$((1 + 3))___"
11791192 enter: false
11801193 """ ,
1181- ),
1182- "___4___" ,
1183- False ,
11841194 ),
1185- ( # NOQA: PT014 RUF100
1186- textwrap .dedent (
1187- """
1195+ output = "___4___" ,
1196+ should_see = False ,
1197+ ),
1198+ WorkspaceEnterFixture ( # NOQA: PT014 RUF100
1199+ test_id = "pane_command_enter_default_shortform" ,
1200+ yaml = textwrap .dedent (
1201+ """
11881202session_name: Should execute
11891203windows:
11901204- panes:
11911205 - shell_command: echo "___$((1 + 3))___"
11921206 """ ,
1193- ),
1194- "___4___" ,
1195- True ,
11961207 ),
1197- (
1198- textwrap .dedent (
1199- """
1208+ output = "___4___" ,
1209+ should_see = True ,
1210+ ),
1211+ WorkspaceEnterFixture (
1212+ test_id = "pane_command_enter_default_longform" ,
1213+ yaml = textwrap .dedent (
1214+ """
12001215session_name: Should execute
12011216windows:
12021217- panes:
12031218 - shell_command:
12041219 - cmd: echo "other command"
12051220 - cmd: echo "___$((1 + 3))___"
12061221 """ ,
1207- ),
1208- "___4___" ,
1209- True ,
12101222 ),
1211- ],
1212- ids = [
1213- "pane_enter_false_shortform" ,
1214- "pane_enter_false_longform" ,
1215- "pane_enter_default_shortform" ,
1216- "pane_enter_default_longform" ,
1217- "pane_command_enter_false_shortform" ,
1218- "pane_command_enter_false_longform" ,
1219- "pane_command_enter_default_shortform" ,
1220- "pane_command_enter_default_longform" ,
1221- ],
1223+ output = "___4___" ,
1224+ should_see = True ,
1225+ ),
1226+ ]
1227+
1228+
1229+ @pytest .mark .parametrize (
1230+ list (WorkspaceEnterFixture ._fields ),
1231+ WORKSPACE_ENTER_FIXTURES ,
1232+ ids = [test .test_id for test in WORKSPACE_ENTER_FIXTURES ],
12221233)
12231234def test_load_workspace_enter (
12241235 tmp_path : pathlib .Path ,
12251236 server : Server ,
12261237 monkeypatch : pytest .MonkeyPatch ,
1238+ test_id : str ,
12271239 yaml : str ,
12281240 output : str ,
12291241 should_see : bool ,
@@ -1255,12 +1267,20 @@ def fn() -> bool:
12551267 ), f"Should{ ' ' if should_see else 'not ' } output in captured pane"
12561268
12571269
1258- @pytest .mark .parametrize (
1259- ("yaml" , "sleep" , "output" ),
1260- [
1261- (
1262- textwrap .dedent (
1263- """
1270+ class WorkspaceSleepFixture (t .NamedTuple ):
1271+ """Test fixture for workspace sleep behavior verification."""
1272+
1273+ test_id : str
1274+ yaml : str
1275+ sleep : float
1276+ output : str
1277+
1278+
1279+ WORKSPACE_SLEEP_FIXTURES : list [WorkspaceSleepFixture ] = [
1280+ WorkspaceSleepFixture (
1281+ test_id = "command_level_sleep_shortform" ,
1282+ yaml = textwrap .dedent (
1283+ """
12641284session_name: Should not execute
12651285windows:
12661286- panes:
@@ -1270,13 +1290,14 @@ def fn() -> bool:
12701290 - cmd: echo "___$((1 + 3))___"
12711291 sleep_before: .35
12721292 """ ,
1273- ),
1274- 0.5 ,
1275- "___4___" ,
12761293 ),
1277- (
1278- textwrap .dedent (
1279- """
1294+ sleep = 0.5 ,
1295+ output = "___4___" ,
1296+ ),
1297+ WorkspaceSleepFixture (
1298+ test_id = "command_level_pane_sleep_longform" ,
1299+ yaml = textwrap .dedent (
1300+ """
12801301session_name: Should not execute
12811302windows:
12821303- panes:
@@ -1286,41 +1307,44 @@ def fn() -> bool:
12861307 - cmd: echo "___$((1 + 3))___"
12871308 sleep_before: .25
12881309 """ ,
1289- ),
1290- 1.25 ,
1291- "___4___" ,
12921310 ),
1293- (
1294- textwrap .dedent (
1295- """
1311+ sleep = 1.25 ,
1312+ output = "___4___" ,
1313+ ),
1314+ WorkspaceSleepFixture (
1315+ test_id = "pane_sleep_shortform" ,
1316+ yaml = textwrap .dedent (
1317+ """
12961318session_name: Should not execute
12971319windows:
12981320- panes:
12991321 - shell_command:
13001322 - cmd: echo "___$((1 + 3))___"
13011323 sleep_before: .5
13021324 """ ,
1303- ),
1304- 0.5 ,
1305- "___4___" ,
13061325 ),
1307- (
1308- textwrap .dedent (
1309- """
1326+ sleep = 0.5 ,
1327+ output = "___4___" ,
1328+ ),
1329+ WorkspaceSleepFixture (
1330+ test_id = "pane_sleep_longform" ,
1331+ yaml = textwrap .dedent (
1332+ """
13101333session_name: Should not execute
13111334windows:
13121335- panes:
13131336 - shell_command:
13141337 - cmd: echo "___$((1 + 3))___"
13151338 sleep_before: 1
13161339 """ ,
1317- ),
1318- 1 ,
1319- "___4___" ,
13201340 ),
1321- (
1322- textwrap .dedent (
1323- """
1341+ sleep = 1 ,
1342+ output = "___4___" ,
1343+ ),
1344+ WorkspaceSleepFixture (
1345+ test_id = "shell_before_before_command_level" ,
1346+ yaml = textwrap .dedent (
1347+ """
13241348session_name: Should not execute
13251349shell_command_before:
13261350 - cmd: echo "sleeping before"
@@ -1329,26 +1353,26 @@ def fn() -> bool:
13291353- panes:
13301354 - echo "___$((1 + 3))___"
13311355 """ ,
1332- ),
1333- 0.5 ,
1334- "___4___" ,
13351356 ),
1336- ],
1337- ids = [
1338- "command_level_sleep_shortform" ,
1339- "command_level_pane_sleep_longform" ,
1340- "pane_sleep_shortform" ,
1341- "pane_sleep_longform" ,
1342- "shell_before_before_command_level" ,
1343- ],
1357+ sleep = 0.5 ,
1358+ output = "___4___" ,
1359+ ),
1360+ ]
1361+
1362+
1363+ @pytest .mark .parametrize (
1364+ list (WorkspaceSleepFixture ._fields ),
1365+ WORKSPACE_SLEEP_FIXTURES ,
1366+ ids = [test .test_id for test in WORKSPACE_SLEEP_FIXTURES ],
13441367)
13451368@pytest .mark .flaky (reruns = 3 )
13461369def test_load_workspace_sleep (
13471370 tmp_path : pathlib .Path ,
13481371 server : Server ,
13491372 monkeypatch : pytest .MonkeyPatch ,
1373+ test_id : str ,
13501374 yaml : str ,
1351- sleep : int ,
1375+ sleep : float ,
13521376 output : str ,
13531377) -> None :
13541378 """Test sleep commands in tmuxp configuration."""
0 commit comments