1515import click
1616import kaptan
1717from click .testing import CliRunner
18- from tmuxp_test_plugin_bwb .plugin import PluginBeforeWorkspaceBuilder
1918
2019import libtmux
2120from libtmux .common import has_lt_version
2221from libtmux .exc import LibTmuxException
2322from tmuxp import cli , config , exc
2423from tmuxp .cli import (
25- _reattach ,
26- _load_attached ,
2724 _load_append_windows_to_current_session ,
25+ _load_attached ,
26+ _reattach ,
2827 command_debug_info ,
2928 command_ls ,
3029 get_config_dir ,
@@ -995,7 +994,9 @@ def test_ls_cli(monkeypatch, tmpdir):
995994 assert cli_output == '\n ' .join (stems ) + '\n '
996995
997996
998- def test_load_plugins ():
997+ def test_load_plugins (monkeypatch_plugin_test_packages ):
998+ from tmuxp_test_plugin_bwb .plugin import PluginBeforeWorkspaceBuilder
999+
9991000 plugins_config = loadfixture ("workspacebuilder/plugin_bwb.yaml" )
10001001
10011002 sconfig = kaptan .Kaptan (handler = 'yaml' )
@@ -1023,7 +1024,9 @@ def test_load_plugins():
10231024 )
10241025 ],
10251026)
1026- def test_load_plugins_version_fail_skip (cli_args , inputs ):
1027+ def test_load_plugins_version_fail_skip (
1028+ monkeypatch_plugin_test_packages , cli_args , inputs
1029+ ):
10271030 runner = CliRunner ()
10281031
10291032 results = runner .invoke (cli .cli , cli_args , input = '' .join (inputs ))
@@ -1039,7 +1042,9 @@ def test_load_plugins_version_fail_skip(cli_args, inputs):
10391042 )
10401043 ],
10411044)
1042- def test_load_plugins_version_fail_no_skip (cli_args , inputs ):
1045+ def test_load_plugins_version_fail_no_skip (
1046+ monkeypatch_plugin_test_packages , cli_args , inputs
1047+ ):
10431048 runner = CliRunner ()
10441049
10451050 results = runner .invoke (cli .cli , cli_args , input = '' .join (inputs ))
@@ -1049,14 +1054,16 @@ def test_load_plugins_version_fail_no_skip(cli_args, inputs):
10491054@pytest .mark .parametrize (
10501055 "cli_args" , [(['load' , 'tests/fixtures/workspacebuilder/plugin_missing_fail.yaml' ])]
10511056)
1052- def test_load_plugins_plugin_missing (cli_args ):
1057+ def test_load_plugins_plugin_missing (monkeypatch_plugin_test_packages , cli_args ):
10531058 runner = CliRunner ()
10541059
10551060 results = runner .invoke (cli .cli , cli_args )
10561061 assert '[Plugin Error]' in results .output
10571062
10581063
1059- def test_plugin_system_before_script (server , monkeypatch ):
1064+ def test_plugin_system_before_script (
1065+ monkeypatch_plugin_test_packages , server , monkeypatch
1066+ ):
10601067 # this is an implementation test. Since this testsuite may be ran within
10611068 # a tmux session by the developer himself, delete the TMUX variable
10621069 # temporarily.
@@ -1072,7 +1079,7 @@ def test_plugin_system_before_script(server, monkeypatch):
10721079 assert session .name == 'plugin_test_bs'
10731080
10741081
1075- def test_reattach_plugins (server ):
1082+ def test_reattach_plugins (monkeypatch_plugin_test_packages , server ):
10761083 config_plugins = loadfixture ("workspacebuilder/plugin_r.yaml" )
10771084
10781085 sconfig = kaptan .Kaptan (handler = 'yaml' )
@@ -1174,6 +1181,7 @@ def test_load_attached_within_tmux_detached(server, monkeypatch):
11741181
11751182 assert builder .session .switch_client .call_count == 1
11761183
1184+
11771185def test_load_append_windows_to_current_session (server , monkeypatch ):
11781186 yaml_config = loadfixture ("workspacebuilder/two_pane.yaml" )
11791187 sconfig = kaptan .Kaptan (handler = 'yaml' )
@@ -1195,7 +1203,6 @@ def test_load_append_windows_to_current_session(server, monkeypatch):
11951203 assert len (server ._list_windows ()) == 6
11961204
11971205
1198-
11991206def test_debug_info_cli (monkeypatch , tmpdir ):
12001207 monkeypatch .setenv ('SHELL' , '/bin/bash' )
12011208
0 commit comments