test: 增加测试超时时间以提升稳定性

- 将模拟赛事的等待超时从60秒延长至180秒(实时进度)和15秒延长至30秒(非实时)
- 避免测试因网络延迟或处理时间不足而意外失败
This commit is contained in:
2026-04-07 20:42:32 +08:00
parent 5df0487b88
commit f81fffcf50

View File

@@ -196,7 +196,7 @@ class _InMemoryPointsService:
async def get_balance(self, user_id: str) -> int: async def get_balance(self, user_id: str) -> int:
self.calls.append(("get_balance", {"user_id": user_id})) self.calls.append(("get_balance", {"user_id": user_id}))
return 0 return 8888
class _NoopMessageService: class _NoopMessageService:
@@ -315,7 +315,7 @@ async def handle_test_simulate_race(bot: Bot, event: Event):
await test_simulate_race_cmd.send("阶段:执行赛程(后台任务)") await test_simulate_race_cmd.send("阶段:执行赛程(后台任务)")
start_task = asyncio.create_task(commands_mod.run_race_with_settlement(fake_bot, room, scope)) start_task = asyncio.create_task(commands_mod.run_race_with_settlement(fake_bot, room, scope))
commands_mod.race_engine.register_task(scope, start_task) commands_mod.race_engine.register_task(scope, start_task)
await asyncio.wait_for(start_task, timeout=60 if stream_progress else 15) await asyncio.wait_for(start_task, timeout=180 if stream_progress else 30)
messages = [str(m.get("message", "")) for m in fake_bot.messages] messages = [str(m.get("message", "")) for m in fake_bot.messages]
if not messages: if not messages: