Test new_aux_window cleanup when set-option fails

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-10 21:21:33 -04:00
parent 9896521fa9
commit 7835511f0a
+14
View File
@@ -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") wid = await runner.new_aux_window("nvim", "/p", ["nvim"], "nvim · p")
assert wid is None 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")