Files
quality_analyse/verification/test_nao_model_timeouts.py
lyun ff7bbe3e46 同步:完善质量分析工作台并更新主题字体
同步已上线的智能分析执行协议、来源查询、图表报告与管理页面配套代码。
补齐数据库迁移、运行依赖和回归测试,保留原有指标计算口径。
统一午夜黑及其他主题的控件细节、中文和业务数字字体。
排除本地业务数据、凭据、预览、发布与验收产物。

验证:生产构建通过,320项前端回归通过;本轮仅同步Git,不再次部署。
2026-10-30 22:40:58 +08:00

20 lines
1.0 KiB
Python

import io,json,sys,threading,unittest
from pathlib import Path
sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'scripts'))
from nao_agent_task import _model_json
class ThinkingTimeoutTest(unittest.TestCase):
def test_valid_slow_local_thinking_plan_is_not_abandoned_at_thirty_seconds(self):
calls=[]
def provider(request,timeout):
calls.append(timeout)
if timeout<50:raise TimeoutError('fixture: correct answer arrives at 49 seconds')
return io.BytesIO(json.dumps({'model':'qwen3.8-27b-local','choices':[{'finish_reason':'stop','message':{'content':'{"goal":"compare formal quality"}'}}]}).encode())
result=_model_json(base_url='http://127.0.0.1:1/v1',api_key='fixture',model='qwen3.8-27b-local',system='fixture',payload={},cancel_event=threading.Event(),opener=provider)
self.assertEqual(result,{'goal':'compare formal quality'})
self.assertEqual(len(calls),1)
from nao_runtime_policy import REQUEST_TIMEOUT_SECONDS
self.assertLessEqual(calls[0],REQUEST_TIMEOUT_SECONDS)
if __name__=='__main__':unittest.main()