Skip to content

Commit bc38520

Browse files
committed
fix ut
1 parent 3b0ef8d commit bc38520

4 files changed

Lines changed: 26 additions & 7 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{"type": "summary", "task_id": "data_driven", "timestamp": "2025-08-05T14:49:13.783963", "num_rollouts": 1, "successful_rollouts": 1, "failed_rollouts": 0, "success_rate": 1.0, "avg_score": 1.0, "std_dev": 0.0, "min_score": 1.0, "max_score": 1.0}
2+
{"type": "individual_result", "task_id": "data_driven", "rollout_index": 0, "timestamp": "2025-08-05T14:49:13.784559", "score": 1.0}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{"type": "summary", "task_id": "test_task", "timestamp": "2025-08-05T14:50:11.743811", "num_rollouts": 2, "successful_rollouts": 2, "failed_rollouts": 0, "success_rate": 1.0, "avg_score": 0.5, "std_dev": 0.7071067811865476, "min_score": 0.0, "max_score": 1.0}
2+
{"type": "individual_result", "task_id": "test_task", "rollout_index": 0, "timestamp": "2025-08-05T14:50:11.744330", "score": 1.0, "sample_data": {"id": "run_001", "seed": 42}}
3+
{"type": "individual_result", "task_id": "test_task", "rollout_index": 1, "timestamp": "2025-08-05T14:50:11.744367", "score": 0.0, "sample_data": {"id": "run_002", "seed": 123}}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{"type": "summary", "task_id": "traditional", "timestamp": "2025-08-05T14:49:13.784961", "num_rollouts": 1, "successful_rollouts": 1, "failed_rollouts": 0, "success_rate": 1.0, "avg_score": 0.5, "std_dev": 0.0, "min_score": 0.5, "max_score": 0.5}
2+
{"type": "individual_result", "task_id": "traditional", "rollout_index": 0, "timestamp": "2025-08-05T14:49:13.785457", "score": 0.5}

tests/test_url_handling.py

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import asyncio
2-
1+
from unittest.mock import AsyncMock, patch
32
import httpx
43
import pytest
54
from werkzeug.wrappers import Response
@@ -17,11 +16,17 @@ async def test_mcp_env_make_appends_trailing_slash():
1716
base_url = "http://localhost:8000/mcp"
1817
corrected_url = "http://localhost:8000/mcp/"
1918

20-
# Use n and seeds to avoid needing a full dataset
21-
envs = await ep.make(base_url, n=1, seeds=[42])
19+
with patch(
20+
"eval_protocol.mcp.client.connection.MCPConnectionManager.initialize_session",
21+
new_callable=AsyncMock,
22+
) as mock_init:
23+
mock_init.return_value = None
24+
25+
envs = await ep.make(base_url, n=1, seeds=[42])
26+
27+
mock_init.assert_awaited_once()
2228

2329
assert len(envs.sessions) == 1
24-
# The session's base_url should have the trailing slash
2530
assert envs.sessions[0].base_url == corrected_url
2631

2732

@@ -32,8 +37,15 @@ async def test_mcp_env_make_keeps_existing_trailing_slash():
3237
"""
3338
base_url = "http://localhost:8000/mcp/"
3439

35-
# Use n and seeds to avoid needing a full dataset
36-
envs = await ep.make(base_url, n=1, seeds=[42])
40+
with patch(
41+
"eval_protocol.mcp.client.connection.MCPConnectionManager.initialize_session",
42+
new_callable=AsyncMock,
43+
) as mock_init:
44+
mock_init.return_value = None
45+
46+
envs = await ep.make(base_url, n=1, seeds=[42])
47+
48+
mock_init.assert_awaited_once()
3749

3850
assert len(envs.sessions) == 1
3951
# The session's base_url should remain unchanged

0 commit comments

Comments
 (0)