V10.578 修正 Code Review timeout 誤報
All checks were successful
CD Pipeline / deploy (push) Successful in 1m5s
All checks were successful
CD Pipeline / deploy (push) Successful in 1m5s
This commit is contained in:
@@ -482,6 +482,31 @@ def test_hermes_scan_defaults_to_static_scan_without_ollama(monkeypatch):
|
||||
assert pipeline.state["severity_summary"]["medium"] == 1
|
||||
|
||||
|
||||
def test_static_scan_accepts_multiline_requests_timeout(monkeypatch):
|
||||
"""多行 requests 呼叫已帶 timeout 時,不應被誤報為未設定 timeout。"""
|
||||
monkeypatch.delenv("CODE_REVIEW_HERMES_LLM_SCAN_ENABLED", raising=False)
|
||||
_stub_logger(monkeypatch)
|
||||
|
||||
svc_mod = _reload_pipeline()
|
||||
pipeline = _make_pipeline(svc_mod)
|
||||
findings = pipeline._hermes_scan({
|
||||
"services/foo.py": (
|
||||
"import requests\n"
|
||||
"def safe(url, timeout_s):\n"
|
||||
" return requests.get(\n"
|
||||
" url,\n"
|
||||
" timeout=timeout_s,\n"
|
||||
" )\n"
|
||||
)
|
||||
})
|
||||
|
||||
assert not any(
|
||||
finding["description"] == "HTTP request 未設定 timeout,可能拖住 worker"
|
||||
for finding in findings
|
||||
)
|
||||
assert pipeline.state["severity_summary"]["medium"] == 0
|
||||
|
||||
|
||||
def test_flag_true_still_uses_ollama_before_claude(monkeypatch):
|
||||
"""flag=true 也不得跳過 Ollama;Ollama 成功時 Claude/Gemini 都不呼叫"""
|
||||
monkeypatch.setenv('CODE_REVIEW_USE_CLAUDE', 'true')
|
||||
|
||||
Reference in New Issue
Block a user