fix(windows): resolve claude.cmd via shutil.which (#124)

Co-authored-by: banteg <4562643+banteg@users.noreply.github.com>
This commit is contained in:
botica
2026-01-15 05:06:13 -06:00
committed by GitHub
parent 495ff261de
commit 81fc88a3cf
2 changed files with 19 additions and 1 deletions
+17
View File
@@ -1,9 +1,11 @@
import json
from pathlib import Path
from typing import cast
import anyio
import pytest
import takopi.runners.claude as claude_runner
from takopi.model import ActionEvent, CompletedEvent, ResumeToken, StartedEvent
from takopi.runners.claude import (
ClaudeRunner,
@@ -62,6 +64,21 @@ def test_claude_resume_format_and_extract() -> None:
assert runner.extract_resume("`codex resume sid`") is None
def test_build_runner_uses_shutil_which(monkeypatch) -> None:
expected = r"C:\Tools\claude.cmd"
called: dict[str, str] = {}
def fake_which(name: str) -> str | None:
called["name"] = name
return expected
monkeypatch.setattr(claude_runner.shutil, "which", fake_which)
runner = cast(ClaudeRunner, claude_runner.build_runner({}, Path("takopi.toml")))
assert called["name"] == "claude"
assert runner.claude_cmd == expected
def test_translate_success_fixture() -> None:
state = ClaudeStreamState()
events: list = []