diff --git a/tests/test_tmux.py b/tests/test_tmux.py index 9d08fc8..52b735b 100644 --- a/tests/test_tmux.py +++ b/tests/test_tmux.py @@ -1069,3 +1069,17 @@ async def test_new_aux_window_returns_none_when_new_window_fails(runner): ] wid = await runner.new_aux_window("nvim", "/p", ["nvim"], "nvim · p") assert wid is None + + +@pytest.mark.asyncio +async def test_new_aux_window_kills_window_when_set_option_fails(runner): + runner._exec.side_effect = [ + (0, "0\n", ""), # _next_window_index + (0, "@7\n", ""), # new-window -> window_id @7 + (1, "", "nope"), # set-option fails + (0, "", ""), # kill-window cleanup + ] + wid = await runner.new_aux_window("nvim", "/p", ["nvim"], "nvim · p") + assert wid is None + # the half-built window must be cleaned up by id. + assert runner._exec.call_args_list[-1].args == ("kill-window", "-t", "@7")