def METHOD_NAME(
    cli_cmd: t.List[str],
    cli_args: t.List[str],
    inputs: t.List[t.Any],
    env: t.Dict[t.Any, t.Any],
    template_ctx: t.Dict[str, str],
    exception: t.Union[
        t.Type[exc.TmuxpException], t.Type[subprocess.CalledProcessError]
    ],
    message: str,
    socket_name: str,
    server: "Server",
    session: Session,
    tmp_path: pathlib.Path,
    monkeypatch: pytest.MonkeyPatch,
    capsys: pytest.CaptureFixture,
) -> None:
    monkeypatch.setenv("HOME", str(tmp_path))
    window_name = "my_window"
    window = session.new_window(window_name=window_name)
    window.split_window()
    assert server.socket_name is not None
    assert session.name is not None
    template_ctx.update(
        {
            "SOCKET_NAME": server.socket_name,
            "SESSION_NAME": session.name,
            "WINDOW_NAME": template_ctx.get("window_name", window_name),
        }
    )
    cli_args = cli_cmd + [cli_arg.format(**template_ctx) for cli_arg in cli_args]
    for k, v in env.items():
        monkeypatch.setenv(k, v.format(**template_ctx))
    monkeypatch.chdir(tmp_path)
    if exception is not None:
        with pytest.raises(exception, match=message.format(**template_ctx)):
            cli.cli(cli_args)
    else:
        cli.cli(cli_args)
        result = capsys.readouterr()
        assert message.format(**template_ctx) in result.out