13
13
import libtmux
14
14
from libtmux .common import has_lt_version
15
15
from libtmux .exc import LibTmuxException
16
- from tmuxp import cli , config
16
+ from tmuxp import cli , config , exc
17
17
from tmuxp .cli import (
18
18
command_ls ,
19
19
get_config_dir ,
@@ -407,7 +407,7 @@ def test_load_zsh_autotitle_warning(cli_args, tmpdir, monkeypatch):
407
407
assert 'Please set' not in result .output
408
408
409
409
410
- @pytest .mark .parametrize ("cli_cmd" , ['shell' , 'shell_plus' ])
410
+ @pytest .mark .parametrize ("cli_cmd" , ['shell' , ( 'shell' , '--pdb' ) ])
411
411
@pytest .mark .parametrize (
412
412
"cli_args,inputs,env,expected_output" ,
413
413
[
@@ -501,7 +501,8 @@ def test_shell(
501
501
SERVER_SOCKET_NAME = server .socket_name ,
502
502
)
503
503
504
- cli_args = [cli_cmd ] + [cli_arg .format (** template_ctx ) for cli_arg in cli_args ]
504
+ cli_cmd = list (cli_cmd ) if isinstance (cli_cmd , (list , tuple )) else [cli_cmd ]
505
+ cli_args = cli_cmd + [cli_arg .format (** template_ctx ) for cli_arg in cli_args ]
505
506
506
507
for k , v in env .items ():
507
508
monkeypatch .setenv (k , v .format (** template_ctx ))
@@ -515,7 +516,13 @@ def test_shell(
515
516
assert expected_output .format (** template_ctx ) in result .output
516
517
517
518
518
- @pytest .mark .parametrize ("cli_cmd" , ['shell' , 'shell_plus' ])
519
+ @pytest .mark .parametrize (
520
+ "cli_cmd" ,
521
+ [
522
+ 'shell' ,
523
+ ('shell' , '--pdb' ),
524
+ ],
525
+ )
519
526
@pytest .mark .parametrize (
520
527
"cli_args,inputs,env,template_ctx,exception,message" ,
521
528
[
@@ -537,7 +544,7 @@ def test_shell(
537
544
[],
538
545
{},
539
546
{'session_name' : 'nonexistant_session' },
540
- None ,
547
+ exc . TmuxpException ,
541
548
'Session not found: nonexistant_session' ,
542
549
),
543
550
(
@@ -551,7 +558,7 @@ def test_shell(
551
558
[],
552
559
{},
553
560
{'window_name' : 'nonexistant_window' },
554
- None ,
561
+ exc . TmuxpException ,
555
562
'Window not found: {WINDOW_NAME}' ,
556
563
),
557
564
],
@@ -583,7 +590,8 @@ def test_shell_target_missing(
583
590
PANE_ID = template_ctx .get ('pane_id' ),
584
591
SERVER_SOCKET_NAME = server .socket_name ,
585
592
)
586
- cli_args = [cli_cmd ] + [cli_arg .format (** template_ctx ) for cli_arg in cli_args ]
593
+ cli_cmd = list (cli_cmd ) if isinstance (cli_cmd , (list , tuple )) else [cli_cmd ]
594
+ cli_args = cli_cmd + [cli_arg .format (** template_ctx ) for cli_arg in cli_args ]
587
595
588
596
for k , v in env .items ():
589
597
monkeypatch .setenv (k , v .format (** template_ctx ))
@@ -603,12 +611,23 @@ def test_shell_target_missing(
603
611
assert message .format (** template_ctx ) in result .output
604
612
605
613
614
+ @pytest .mark .parametrize (
615
+ "cli_cmd" ,
616
+ [
617
+ # 'shell',
618
+ # ('shell', '--pdb'),
619
+ ('shell' , '--code' ),
620
+ # ('shell', '--bpython'),
621
+ # ('shell', '--ptipython'),
622
+ # ('shell', '--ptpython'),
623
+ # ('shell', '--ipython'),
624
+ ],
625
+ )
606
626
@pytest .mark .parametrize (
607
627
"cli_args,inputs,env,message" ,
608
628
[
609
629
(
610
630
[
611
- 'shell_plus' ,
612
631
'-L{SOCKET_NAME}' ,
613
632
],
614
633
[],
@@ -617,7 +636,6 @@ def test_shell_target_missing(
617
636
),
618
637
(
619
638
[
620
- 'shell_plus' ,
621
639
'-L{SOCKET_NAME}' ,
622
640
],
623
641
[],
@@ -627,6 +645,7 @@ def test_shell_target_missing(
627
645
],
628
646
)
629
647
def test_shell_plus (
648
+ cli_cmd ,
630
649
cli_args ,
631
650
inputs ,
632
651
env ,
@@ -650,7 +669,9 @@ def test_shell_plus(
650
669
SERVER_SOCKET_NAME = server .socket_name ,
651
670
)
652
671
653
- cli_args [:] = [cli_arg .format (** template_ctx ) for cli_arg in cli_args ]
672
+ cli_cmd = list (cli_cmd ) if isinstance (cli_cmd , (list , tuple )) else [cli_cmd ]
673
+ cli_args = cli_cmd + [cli_arg .format (** template_ctx ) for cli_arg in cli_args ]
674
+
654
675
for k , v in env .items ():
655
676
monkeypatch .setenv (k , v .format (** template_ctx ))
656
677
0 commit comments