From 0d074e5465475f87c2dfab2f167c1fcdac166773 Mon Sep 17 00:00:00 2001 From: sinohqb Date: Mon, 24 Aug 2026 23:38:53 +0800 Subject: [PATCH] =?UTF-8?q?test(runs):=20=E5=8F=96=E6=B6=88=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E6=89=A9=E8=87=B3=2030=20case=20=E9=80=82=E9=85=8D?= =?UTF-8?q?=E5=B9=B6=E5=8F=91=E6=89=A7=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit case 并行(默认 3)后原 5 case 场景在取消请求到达前就跑完, 取消语义不再被观测到。扩到 30 case(10 波)保证取消窗口充分。 --- tests/integration/test_runs_api.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/integration/test_runs_api.py b/tests/integration/test_runs_api.py index 48afd61..95ecac4 100644 --- a/tests/integration/test_runs_api.py +++ b/tests/integration/test_runs_api.py @@ -135,13 +135,15 @@ async def test_start_run_then_get(client, seeded_db, mock_channel): async def test_cancel_run(client, seeded_db, mock_channel): # Seed a multi-case scenario so the run takes long enough to cancel. + # Cases run 3-concurrent, so 30 cases ≈ 10 waves × reply_delay — comfortably + # longer than the pre-cancel window below. from agenteval.models import Case, CaseType, Scenario from agenteval.storage.repository import ScenarioRepository multi = Scenario( id="s-long", name="long-scenario", cases=[ Case(id=f"lc{i}", type=CaseType.SINGLE, messages=[f"m{i}"]) - for i in range(5) + for i in range(30) ], ) ScenarioRepository(seeded_db).create(multi) @@ -170,8 +172,8 @@ async def test_cancel_run(client, seeded_db, mock_channel): final = (await client.get(f"/api/runs/{run_id}")).json() assert final["status"] == "failed" assert final["summary"]["error"]["code"] == "cancelled_by_user" - # Not all 5 cases should have run. - assert mock_channel.send_calls < 5 + # Not all 30 cases should have run. + assert mock_channel.send_calls < 30 async def test_get_run_logs(client, seeded_db, mock_channel):