@@ -209,6 +209,81 @@ class CLILoadFixture(t.NamedTuple):
209
209
expected_not_in_err : ExpectedOutput = None
210
210
211
211
212
+ class ZshAutotitleTestFixture (t .NamedTuple ):
213
+ """Test fixture for zsh auto title warning tests."""
214
+
215
+ test_id : str
216
+ cli_args : list [str ]
217
+
218
+
219
+ class LogFileTestFixture (t .NamedTuple ):
220
+ """Test fixture for log file tests."""
221
+
222
+ test_id : str
223
+ cli_args : list [str ]
224
+
225
+
226
+ class PluginVersionTestFixture (t .NamedTuple ):
227
+ """Test fixture for plugin version tests."""
228
+
229
+ test_id : str
230
+ cli_args : list [str ]
231
+ inputs : list [str ]
232
+
233
+
234
+ class PluginMissingTestFixture (t .NamedTuple ):
235
+ """Test fixture for plugin missing tests."""
236
+
237
+ test_id : str
238
+ cli_args : list [str ]
239
+
240
+
241
+ ZSH_AUTOTITLE_TEST_FIXTURES : list [ZshAutotitleTestFixture ] = [
242
+ ZshAutotitleTestFixture (
243
+ test_id = "load_dot_detached" ,
244
+ cli_args = ["load" , "." , "-d" ],
245
+ ),
246
+ ZshAutotitleTestFixture (
247
+ test_id = "load_yaml_detached" ,
248
+ cli_args = ["load" , ".tmuxp.yaml" , "-d" ],
249
+ ),
250
+ ]
251
+
252
+
253
+ LOG_FILE_TEST_FIXTURES : list [LogFileTestFixture ] = [
254
+ LogFileTestFixture (
255
+ test_id = "load_with_log_file" ,
256
+ cli_args = ["load" , "." , "--log-file" , "log.txt" , "-d" ],
257
+ ),
258
+ ]
259
+
260
+
261
+ PLUGIN_VERSION_SKIP_TEST_FIXTURES : list [PluginVersionTestFixture ] = [
262
+ PluginVersionTestFixture (
263
+ test_id = "skip_version_fail" ,
264
+ cli_args = ["load" , "tests/fixtures/workspace/builder/plugin_versions_fail.yaml" ],
265
+ inputs = ["y\n " ],
266
+ ),
267
+ ]
268
+
269
+
270
+ PLUGIN_VERSION_NO_SKIP_TEST_FIXTURES : list [PluginVersionTestFixture ] = [
271
+ PluginVersionTestFixture (
272
+ test_id = "no_skip_version_fail" ,
273
+ cli_args = ["load" , "tests/fixtures/workspace/builder/plugin_versions_fail.yaml" ],
274
+ inputs = ["n\n " ],
275
+ ),
276
+ ]
277
+
278
+
279
+ PLUGIN_MISSING_TEST_FIXTURES : list [PluginMissingTestFixture ] = [
280
+ PluginMissingTestFixture (
281
+ test_id = "missing_plugin" ,
282
+ cli_args = ["load" , "tests/fixtures/workspace/builder/plugin_missing_fail.yaml" ],
283
+ ),
284
+ ]
285
+
286
+
212
287
TEST_LOAD_FIXTURES : list [CLILoadFixture ] = [
213
288
CLILoadFixture (
214
289
test_id = "dir-relative-dot-samedir" ,
@@ -360,17 +435,19 @@ def test_regression_00132_session_name_with_dots(
360
435
361
436
362
437
@pytest .mark .parametrize (
363
- "cli_args" ,
364
- [["load" , "." , "-d" ], ["load" , ".tmuxp.yaml" , "-d" ]],
438
+ list (ZshAutotitleTestFixture ._fields ),
439
+ ZSH_AUTOTITLE_TEST_FIXTURES ,
440
+ ids = [test .test_id for test in ZSH_AUTOTITLE_TEST_FIXTURES ],
365
441
)
366
442
def test_load_zsh_autotitle_warning (
443
+ test_id : str ,
367
444
cli_args : list [str ],
368
445
tmp_path : pathlib .Path ,
369
446
monkeypatch : pytest .MonkeyPatch ,
370
447
capsys : pytest .CaptureFixture [str ],
371
448
server : Server ,
372
449
) -> None :
373
- """Test loading ZSH without DISABLE_AUTO_TITLE raises warning ."""
450
+ """Test warning when ZSH auto title is enabled ."""
374
451
# create dummy tmuxp yaml so we don't get yelled at
375
452
yaml_config = tmp_path / ".tmuxp.yaml"
376
453
yaml_config .write_text (
@@ -418,18 +495,18 @@ def test_load_zsh_autotitle_warning(
418
495
419
496
420
497
@pytest .mark .parametrize (
421
- "cli_args" ,
422
- [
423
- (["load" , "." , "--log-file" , "log.txt" , "-d" ]),
424
- ],
498
+ list (LogFileTestFixture ._fields ),
499
+ LOG_FILE_TEST_FIXTURES ,
500
+ ids = [test .test_id for test in LOG_FILE_TEST_FIXTURES ],
425
501
)
426
502
def test_load_log_file (
503
+ test_id : str ,
427
504
cli_args : list [str ],
428
505
tmp_path : pathlib .Path ,
429
506
monkeypatch : pytest .MonkeyPatch ,
430
507
capsys : pytest .CaptureFixture [str ],
431
508
) -> None :
432
- """Test loading via tmuxp load with -- log- file."""
509
+ """Test loading with a log file."""
433
510
# create dummy tmuxp yaml that breaks to prevent actually loading tmux
434
511
tmuxp_config_path = tmp_path / ".tmuxp.yaml"
435
512
tmuxp_config_path .write_text (
@@ -480,21 +557,18 @@ def test_load_plugins(
480
557
481
558
@pytest .mark .skip ("Not sure how to clean up the tmux session this makes" )
482
559
@pytest .mark .parametrize (
483
- ("cli_args" , "inputs" ),
484
- [
485
- (
486
- ["load" , "tests/fixtures/workspace/builder/plugin_versions_fail.yaml" ],
487
- ["y\n " ],
488
- ),
489
- ],
560
+ list (PluginVersionTestFixture ._fields ),
561
+ PLUGIN_VERSION_SKIP_TEST_FIXTURES ,
562
+ ids = [test .test_id for test in PLUGIN_VERSION_SKIP_TEST_FIXTURES ],
490
563
)
491
564
def test_load_plugins_version_fail_skip (
492
565
monkeypatch_plugin_test_packages : None ,
566
+ test_id : str ,
493
567
cli_args : list [str ],
494
568
inputs : list [str ],
495
569
capsys : pytest .CaptureFixture [str ],
496
570
) -> None :
497
- """Test tmuxp load with plugins failing version constraints can continue ."""
571
+ """Test plugin version failure with skip ."""
498
572
with contextlib .suppress (SystemExit ):
499
573
cli .cli (cli_args )
500
574
@@ -504,22 +578,19 @@ def test_load_plugins_version_fail_skip(
504
578
505
579
506
580
@pytest .mark .parametrize (
507
- ("cli_args" , "inputs" ),
508
- [
509
- (
510
- ["load" , "tests/fixtures/workspace/builder/plugin_versions_fail.yaml" ],
511
- ["n\n " ],
512
- ),
513
- ],
581
+ list (PluginVersionTestFixture ._fields ),
582
+ PLUGIN_VERSION_NO_SKIP_TEST_FIXTURES ,
583
+ ids = [test .test_id for test in PLUGIN_VERSION_NO_SKIP_TEST_FIXTURES ],
514
584
)
515
585
def test_load_plugins_version_fail_no_skip (
516
586
monkeypatch_plugin_test_packages : None ,
587
+ test_id : str ,
517
588
cli_args : list [str ],
518
589
inputs : list [str ],
519
590
monkeypatch : pytest .MonkeyPatch ,
520
591
capsys : pytest .CaptureFixture [str ],
521
592
) -> None :
522
- """Test tmuxp load with plugins failing version constraints can exit ."""
593
+ """Test plugin version failure without skip ."""
523
594
monkeypatch .setattr ("sys.stdin" , io .StringIO ("" .join (inputs )))
524
595
525
596
with contextlib .suppress (SystemExit ):
@@ -531,15 +602,17 @@ def test_load_plugins_version_fail_no_skip(
531
602
532
603
533
604
@pytest .mark .parametrize (
534
- "cli_args" ,
535
- [(["load" , "tests/fixtures/workspace/builder/plugin_missing_fail.yaml" ])],
605
+ list (PluginMissingTestFixture ._fields ),
606
+ PLUGIN_MISSING_TEST_FIXTURES ,
607
+ ids = [test .test_id for test in PLUGIN_MISSING_TEST_FIXTURES ],
536
608
)
537
609
def test_load_plugins_plugin_missing (
538
610
monkeypatch_plugin_test_packages : None ,
611
+ test_id : str ,
539
612
cli_args : list [str ],
540
613
capsys : pytest .CaptureFixture [str ],
541
614
) -> None :
542
- """Test tmuxp load with plugins missing raise an error ."""
615
+ """Test loading with missing plugin ."""
543
616
with contextlib .suppress (SystemExit ):
544
617
cli .cli (cli_args )
545
618
0 commit comments