Co-Authored-By: Quentin Torroba <quentin.torroba@mistral.ai>
Co-Authored-By: Michel Thomazo <michel.thomazo@mistral.ai>
This commit is contained in:
Mathias Gesbert 2025-12-22 13:33:20 +01:00 committed by Mathias Gesbert
parent 402e898f39
commit 2e1e15120d
32 changed files with 391 additions and 549 deletions

View file

@ -426,7 +426,7 @@ class TestSessionManagement:
class TestSessionUpdates:
@pytest.mark.asyncio
async def test_agent_message_chunk_structure(self, vibe_home_dir: Path) -> None:
mock_env = get_mocking_env([mock_llm_chunk(content="Hi") for _ in range(2)])
mock_env = get_mocking_env([mock_llm_chunk(content="Hi")])
async for process in get_acp_agent_process(
mock_env=mock_env, vibe_home=vibe_home_dir
):
@ -465,7 +465,6 @@ class TestSessionUpdates:
@pytest.mark.asyncio
async def test_tool_call_update_structure(self, vibe_home_dir: Path) -> None:
mock_env = get_mocking_env([
mock_llm_chunk(content="Hey"),
mock_llm_chunk(
tool_calls=[
ToolCall(
@ -475,14 +474,9 @@ class TestSessionUpdates:
type="function",
index=0,
)
],
name="bash",
finish_reason="tool_calls",
),
mock_llm_chunk(
content="The files containing the pattern 'auth' are ...",
finish_reason="stop",
]
),
mock_llm_chunk(content="The files containing the pattern 'auth' are ..."),
])
async for process in get_acp_agent_process(
mock_env=mock_env, vibe_home=vibe_home_dir
@ -567,7 +561,6 @@ class TestToolCallStructure:
self, vibe_home_grep_ask: Path
) -> None:
custom_results = [
mock_llm_chunk(content="Hey"),
mock_llm_chunk(
tool_calls=[
ToolCall(
@ -578,10 +571,8 @@ class TestToolCallStructure:
type="function",
index=0,
)
],
name="grep",
finish_reason="tool_calls",
),
]
)
]
mock_env = get_mocking_env(custom_results)
async for process in get_acp_agent_process(
@ -628,7 +619,6 @@ class TestToolCallStructure:
self, vibe_home_grep_ask: Path
) -> None:
custom_results = [
mock_llm_chunk(content="Hey"),
mock_llm_chunk(
tool_calls=[
ToolCall(
@ -639,13 +629,10 @@ class TestToolCallStructure:
type="function",
index=0,
)
],
name="grep",
finish_reason="tool_calls",
),
mock_llm_chunk(
content="The search for 'auth' has been completed", finish_reason="stop"
]
),
mock_llm_chunk(content="The search for 'auth' has been completed"),
mock_llm_chunk(content="The file test.txt has been created"),
]
mock_env = get_mocking_env(custom_results)
async for process in get_acp_agent_process(
@ -692,7 +679,6 @@ class TestToolCallStructure:
self, vibe_home_grep_ask: Path
) -> None:
custom_results = [
mock_llm_chunk(content="Hey"),
mock_llm_chunk(
tool_calls=[
ToolCall(
@ -703,14 +689,11 @@ class TestToolCallStructure:
type="function",
index=0,
)
],
name="grep",
finish_reason="tool_calls",
]
),
mock_llm_chunk(
content="The search for 'auth' has not been performed, "
"because you rejected the permission request",
finish_reason="stop",
"because you rejected the permission request"
),
]
mock_env = get_mocking_env(custom_results)
@ -759,7 +742,6 @@ class TestToolCallStructure:
self, vibe_home_grep_ask: Path
) -> None:
custom_results = [
mock_llm_chunk(content="Hey"),
mock_llm_chunk(
tool_calls=[
ToolCall(
@ -770,13 +752,10 @@ class TestToolCallStructure:
type="function",
index=0,
)
],
name="grep",
finish_reason="tool_calls",
),
mock_llm_chunk(
content="The search for 'auth' has been completed", finish_reason="stop"
]
),
mock_llm_chunk(content="The search for 'auth' has been completed"),
mock_llm_chunk(content="The command sleep 3 has been run"),
]
mock_env = get_mocking_env(custom_results)
async for process in get_acp_agent_process(
@ -820,7 +799,6 @@ class TestToolCallStructure:
self, vibe_home_grep_ask: Path
) -> None:
custom_results = [
mock_llm_chunk(content="Hey"),
mock_llm_chunk(
tool_calls=[
ToolCall(
@ -831,14 +809,11 @@ class TestToolCallStructure:
type="function",
index=0,
)
],
name="grep",
finish_reason="tool_calls",
]
),
mock_llm_chunk(
content="The search for 'auth' has failed "
"because the path does not exist",
finish_reason="stop",
"because the path does not exist"
),
]
mock_env = get_mocking_env(custom_results)
@ -894,7 +869,6 @@ class TestCancellationStructure:
self, vibe_home_dir: Path
) -> None:
custom_results = [
mock_llm_chunk(content="Hey"),
mock_llm_chunk(
tool_calls=[
ToolCall(
@ -906,14 +880,11 @@ class TestCancellationStructure:
type="function",
index=0,
)
],
name="write_file",
finish_reason="tool_calls",
]
),
mock_llm_chunk(
content="The file test.txt has not been created, "
"because you cancelled the permission request",
finish_reason="stop",
"because you cancelled the permission request"
),
]
mock_env = get_mocking_env(custom_results)