1313import libtmux
1414from libtmux .common import has_lt_version
1515from libtmux .exc import LibTmuxException
16- from tmuxp import cli , config
16+ from tmuxp import cli , config , exc
1717from tmuxp .cli import (
1818 command_ls ,
1919 get_config_dir ,
@@ -407,7 +407,7 @@ def test_load_zsh_autotitle_warning(cli_args, tmpdir, monkeypatch):
407407 assert 'Please set' not in result .output
408408
409409
410- @pytest .mark .parametrize ("cli_cmd" , ['shell' , 'shell_plus' ])
410+ @pytest .mark .parametrize ("cli_cmd" , ['shell' , ( 'shell' , '--pdb' ) ])
411411@pytest .mark .parametrize (
412412 "cli_args,inputs,env,expected_output" ,
413413 [
@@ -501,7 +501,8 @@ def test_shell(
501501 SERVER_SOCKET_NAME = server .socket_name ,
502502 )
503503
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 ]
505506
506507 for k , v in env .items ():
507508 monkeypatch .setenv (k , v .format (** template_ctx ))
@@ -515,7 +516,13 @@ def test_shell(
515516 assert expected_output .format (** template_ctx ) in result .output
516517
517518
518- @pytest .mark .parametrize ("cli_cmd" , ['shell' , 'shell_plus' ])
519+ @pytest .mark .parametrize (
520+ "cli_cmd" ,
521+ [
522+ 'shell' ,
523+ ('shell' , '--pdb' ),
524+ ],
525+ )
519526@pytest .mark .parametrize (
520527 "cli_args,inputs,env,template_ctx,exception,message" ,
521528 [
@@ -537,7 +544,7 @@ def test_shell(
537544 [],
538545 {},
539546 {'session_name' : 'nonexistant_session' },
540- None ,
547+ exc . TmuxpException ,
541548 'Session not found: nonexistant_session' ,
542549 ),
543550 (
@@ -551,7 +558,7 @@ def test_shell(
551558 [],
552559 {},
553560 {'window_name' : 'nonexistant_window' },
554- None ,
561+ exc . TmuxpException ,
555562 'Window not found: {WINDOW_NAME}' ,
556563 ),
557564 ],
@@ -583,7 +590,8 @@ def test_shell_target_missing(
583590 PANE_ID = template_ctx .get ('pane_id' ),
584591 SERVER_SOCKET_NAME = server .socket_name ,
585592 )
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 ]
587595
588596 for k , v in env .items ():
589597 monkeypatch .setenv (k , v .format (** template_ctx ))
@@ -603,12 +611,23 @@ def test_shell_target_missing(
603611 assert message .format (** template_ctx ) in result .output
604612
605613
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+ )
606626@pytest .mark .parametrize (
607627 "cli_args,inputs,env,message" ,
608628 [
609629 (
610630 [
611- 'shell_plus' ,
612631 '-L{SOCKET_NAME}' ,
613632 ],
614633 [],
@@ -617,7 +636,6 @@ def test_shell_target_missing(
617636 ),
618637 (
619638 [
620- 'shell_plus' ,
621639 '-L{SOCKET_NAME}' ,
622640 ],
623641 [],
@@ -627,6 +645,7 @@ def test_shell_target_missing(
627645 ],
628646)
629647def test_shell_plus (
648+ cli_cmd ,
630649 cli_args ,
631650 inputs ,
632651 env ,
@@ -650,7 +669,9 @@ def test_shell_plus(
650669 SERVER_SOCKET_NAME = server .socket_name ,
651670 )
652671
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+
654675 for k , v in env .items ():
655676 monkeypatch .setenv (k , v .format (** template_ctx ))
656677
0 commit comments