Fixes for issue 113 and 116

This commit is contained in:
Alishahryar1 2026-04-18 16:32:31 -07:00
parent 7468f53ab7
commit 835d0454e8
28 changed files with 807 additions and 83 deletions

View file

@ -25,6 +25,7 @@ class TestSettings:
assert isinstance(settings.provider_rate_window, int)
assert isinstance(settings.nim.temperature, float)
assert isinstance(settings.fast_prefix_detection, bool)
assert isinstance(settings.enable_thinking, bool)
def test_get_settings_cached(self):
"""Test get_settings returns cached instance."""
@ -104,6 +105,22 @@ class TestSettings:
settings = Settings()
assert settings.http_connect_timeout == 5.0
def test_enable_thinking_from_env(self, monkeypatch):
"""ENABLE_THINKING env var is loaded into settings."""
from config.settings import Settings
monkeypatch.setenv("ENABLE_THINKING", "false")
settings = Settings()
assert settings.enable_thinking is False
def test_removed_nim_enable_thinking_raises(self, monkeypatch):
"""NIM_ENABLE_THINKING now fails fast with a migration message."""
from config.settings import Settings
monkeypatch.setenv("NIM_ENABLE_THINKING", "false")
with pytest.raises(ValidationError, match="Rename it to ENABLE_THINKING"):
Settings()
# --- NimSettings Validation Tests ---
class TestNimSettingsValidBounds:
@ -228,6 +245,13 @@ class TestNimSettingsValidators:
with pytest.raises(ValidationError):
NimSettings(**cast(Any, {"unknown_field": "value"}))
def test_enable_thinking_field_removed(self):
"""NimSettings no longer accepts the removed thinking toggle."""
from typing import Any, cast
with pytest.raises(ValidationError):
NimSettings(**cast(Any, {"enable_thinking": True}))
class TestSettingsOptionalStr:
"""Test Settings parse_optional_str validator."""