mirror of
https://github.com/usestrix/strix.git
synced 2026-08-28 05:25:00 +00:00
fix(test): isolate Settings() from ambient settings env vars
This commit is contained in:
parent
3f850d4dc6
commit
65cd8fea19
1 changed files with 25 additions and 0 deletions
|
|
@ -6,6 +6,7 @@ flow through to the root agent's ``build_strix_agent`` call.
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from typing import Any
|
||||
|
||||
import httpx
|
||||
|
|
@ -21,6 +22,30 @@ from strix.core.agents import AgentCoordinator
|
|||
from strix.runtime import session_manager
|
||||
|
||||
|
||||
_SETTINGS_ENV_PREFIXES = (
|
||||
"STRIX_",
|
||||
"LLM_",
|
||||
"OPENAI_",
|
||||
"DEDUPE_LLM_",
|
||||
"LITELLM_",
|
||||
"OLLAMA_",
|
||||
"PERPLEXITY_",
|
||||
"POSTMAN_",
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def _clear_settings_env(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
"""Drop ambient settings env vars so Settings() builds deterministically.
|
||||
|
||||
A malformed unrelated value (e.g. a non-JSON LLM_EXTRA_HEADERS) would
|
||||
otherwise make Settings() raise before the fields under test are assigned.
|
||||
"""
|
||||
for key in list(os.environ):
|
||||
if key.startswith(_SETTINGS_ENV_PREFIXES):
|
||||
monkeypatch.delenv(key, raising=False)
|
||||
|
||||
|
||||
def _make_rate_limit_error() -> RateLimitError:
|
||||
request = httpx.Request("POST", "https://api.openai.com/v1/responses")
|
||||
response = httpx.Response(status_code=429, request=request)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue