@@ -359,18 +359,39 @@ def test_regression_00132_session_name_with_dots(
359
359
cli .cli (["load" , * cli_args ])
360
360
361
361
362
+ class ZshAutotitleTestFixture (t .NamedTuple ):
363
+ """Test fixture for zsh auto title warning tests."""
364
+
365
+ test_id : str
366
+ cli_args : list [str ]
367
+
368
+
369
+ ZSH_AUTOTITLE_TEST_FIXTURES : list [ZshAutotitleTestFixture ] = [
370
+ ZshAutotitleTestFixture (
371
+ test_id = "load_dot_detached" ,
372
+ cli_args = ["load" , "." , "-d" ],
373
+ ),
374
+ ZshAutotitleTestFixture (
375
+ test_id = "load_yaml_detached" ,
376
+ cli_args = ["load" , ".tmuxp.yaml" , "-d" ],
377
+ ),
378
+ ]
379
+
380
+
362
381
@pytest .mark .parametrize (
363
- "cli_args" ,
364
- [["load" , "." , "-d" ], ["load" , ".tmuxp.yaml" , "-d" ]],
382
+ list (ZshAutotitleTestFixture ._fields ),
383
+ ZSH_AUTOTITLE_TEST_FIXTURES ,
384
+ ids = [test .test_id for test in ZSH_AUTOTITLE_TEST_FIXTURES ],
365
385
)
366
386
def test_load_zsh_autotitle_warning (
387
+ test_id : str ,
367
388
cli_args : list [str ],
368
389
tmp_path : pathlib .Path ,
369
390
monkeypatch : pytest .MonkeyPatch ,
370
391
capsys : pytest .CaptureFixture [str ],
371
392
server : Server ,
372
393
) -> None :
373
- """Test loading ZSH without DISABLE_AUTO_TITLE raises warning ."""
394
+ """Test warning when ZSH auto title is enabled ."""
374
395
# create dummy tmuxp yaml so we don't get yelled at
375
396
yaml_config = tmp_path / ".tmuxp.yaml"
376
397
yaml_config .write_text (
@@ -417,19 +438,34 @@ def test_load_zsh_autotitle_warning(
417
438
assert "Please set" not in result .out
418
439
419
440
441
+ class LogFileTestFixture (t .NamedTuple ):
442
+ """Test fixture for log file tests."""
443
+
444
+ test_id : str
445
+ cli_args : list [str ]
446
+
447
+
448
+ LOG_FILE_TEST_FIXTURES : list [LogFileTestFixture ] = [
449
+ LogFileTestFixture (
450
+ test_id = "load_with_log_file" ,
451
+ cli_args = ["load" , "." , "--log-file" , "log.txt" , "-d" ],
452
+ ),
453
+ ]
454
+
455
+
420
456
@pytest .mark .parametrize (
421
- "cli_args" ,
422
- [
423
- (["load" , "." , "--log-file" , "log.txt" , "-d" ]),
424
- ],
457
+ list (LogFileTestFixture ._fields ),
458
+ LOG_FILE_TEST_FIXTURES ,
459
+ ids = [test .test_id for test in LOG_FILE_TEST_FIXTURES ],
425
460
)
426
461
def test_load_log_file (
462
+ test_id : str ,
427
463
cli_args : list [str ],
428
464
tmp_path : pathlib .Path ,
429
465
monkeypatch : pytest .MonkeyPatch ,
430
466
capsys : pytest .CaptureFixture [str ],
431
467
) -> None :
432
- """Test loading via tmuxp load with -- log- file."""
468
+ """Test loading with a log file."""
433
469
# create dummy tmuxp yaml that breaks to prevent actually loading tmux
434
470
tmuxp_config_path = tmp_path / ".tmuxp.yaml"
435
471
tmuxp_config_path .write_text (
@@ -478,23 +514,37 @@ def test_load_plugins(
478
514
assert plugin .__class__ in test_plugin_class_types
479
515
480
516
517
+ class PluginVersionTestFixture (t .NamedTuple ):
518
+ """Test fixture for plugin version tests."""
519
+
520
+ test_id : str
521
+ cli_args : list [str ]
522
+ inputs : list [str ]
523
+
524
+
525
+ PLUGIN_VERSION_SKIP_TEST_FIXTURES : list [PluginVersionTestFixture ] = [
526
+ PluginVersionTestFixture (
527
+ test_id = "skip_version_fail" ,
528
+ cli_args = ["load" , "tests/fixtures/workspace/builder/plugin_versions_fail.yaml" ],
529
+ inputs = ["y\n " ],
530
+ ),
531
+ ]
532
+
533
+
481
534
@pytest .mark .skip ("Not sure how to clean up the tmux session this makes" )
482
535
@pytest .mark .parametrize (
483
- ("cli_args" , "inputs" ),
484
- [
485
- (
486
- ["load" , "tests/fixtures/workspace/builder/plugin_versions_fail.yaml" ],
487
- ["y\n " ],
488
- ),
489
- ],
536
+ list (PluginVersionTestFixture ._fields ),
537
+ PLUGIN_VERSION_SKIP_TEST_FIXTURES ,
538
+ ids = [test .test_id for test in PLUGIN_VERSION_SKIP_TEST_FIXTURES ],
490
539
)
491
540
def test_load_plugins_version_fail_skip (
492
541
monkeypatch_plugin_test_packages : None ,
542
+ test_id : str ,
493
543
cli_args : list [str ],
494
544
inputs : list [str ],
495
545
capsys : pytest .CaptureFixture [str ],
496
546
) -> None :
497
- """Test tmuxp load with plugins failing version constraints can continue ."""
547
+ """Test plugin version failure with skip ."""
498
548
with contextlib .suppress (SystemExit ):
499
549
cli .cli (cli_args )
500
550
@@ -503,23 +553,29 @@ def test_load_plugins_version_fail_skip(
503
553
assert "[Loading]" in result .out
504
554
505
555
556
+ PLUGIN_VERSION_NO_SKIP_TEST_FIXTURES : list [PluginVersionTestFixture ] = [
557
+ PluginVersionTestFixture (
558
+ test_id = "no_skip_version_fail" ,
559
+ cli_args = ["load" , "tests/fixtures/workspace/builder/plugin_versions_fail.yaml" ],
560
+ inputs = ["n\n " ],
561
+ ),
562
+ ]
563
+
564
+
506
565
@pytest .mark .parametrize (
507
- ("cli_args" , "inputs" ),
508
- [
509
- (
510
- ["load" , "tests/fixtures/workspace/builder/plugin_versions_fail.yaml" ],
511
- ["n\n " ],
512
- ),
513
- ],
566
+ list (PluginVersionTestFixture ._fields ),
567
+ PLUGIN_VERSION_NO_SKIP_TEST_FIXTURES ,
568
+ ids = [test .test_id for test in PLUGIN_VERSION_NO_SKIP_TEST_FIXTURES ],
514
569
)
515
570
def test_load_plugins_version_fail_no_skip (
516
571
monkeypatch_plugin_test_packages : None ,
572
+ test_id : str ,
517
573
cli_args : list [str ],
518
574
inputs : list [str ],
519
575
monkeypatch : pytest .MonkeyPatch ,
520
576
capsys : pytest .CaptureFixture [str ],
521
577
) -> None :
522
- """Test tmuxp load with plugins failing version constraints can exit ."""
578
+ """Test plugin version failure without skip ."""
523
579
monkeypatch .setattr ("sys.stdin" , io .StringIO ("" .join (inputs )))
524
580
525
581
with contextlib .suppress (SystemExit ):
@@ -530,16 +586,33 @@ def test_load_plugins_version_fail_no_skip(
530
586
assert "[Not Skipping]" in result .out
531
587
532
588
589
+ class PluginMissingTestFixture (t .NamedTuple ):
590
+ """Test fixture for plugin missing tests."""
591
+
592
+ test_id : str
593
+ cli_args : list [str ]
594
+
595
+
596
+ PLUGIN_MISSING_TEST_FIXTURES : list [PluginMissingTestFixture ] = [
597
+ PluginMissingTestFixture (
598
+ test_id = "missing_plugin" ,
599
+ cli_args = ["load" , "tests/fixtures/workspace/builder/plugin_missing_fail.yaml" ],
600
+ ),
601
+ ]
602
+
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