test: pin OCR live tests to trust_env=false

httpx reads the macOS system proxy config (not just env vars) when
trust_env is on, and the proxy answers 403 for the LAN service at
10.77.0.20. The raw-httpx case in this file already passed
trust_env=False; the OcrClient cases relied on the default and failed on
any machine with a system proxy enabled.
This commit is contained in:
2026-07-29 23:57:44 -04:00
parent f92065bc0b
commit 91671a77df
@@ -46,6 +46,10 @@ def _env(sources: dict[int, str], **extra: str) -> dict[str, str]:
f"OCR__MONKEY__{n}__API_KEY": "none",
f"OCR__MONKEY__{n}__MODEL": "monkey-ocr",
f"OCR__MONKEY__{n}__TIMEOUT_S": "300",
# 服务在 LAN,开发机若开着系统代理(httpx trust_env 读 macOS 系统配置,
# 不是环境变量),代理会对内网地址回 403 —— 与本文件 raw httpx 用例
# 显式传 trust_env=False 同因
f"OCR__MONKEY__{n}__TRUST_ENV": "false",
}
env.update(extra)
return env