feat(tests): scaffold + integration smoke tests (config, db, models, pipeline)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
35
tests/scaffold/test_config.py
Normal file
35
tests/scaffold/test_config.py
Normal file
@@ -0,0 +1,35 @@
|
||||
"""Smoke tests for codex.config.Settings."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from codex.config import Settings, get_settings
|
||||
|
||||
|
||||
def test_settings_defaults() -> None:
|
||||
"""Settings() is constructable without env vars; expected defaults are set."""
|
||||
s = Settings()
|
||||
assert s.database_url == "postgresql://researcher:change_me@localhost:5432/papers"
|
||||
assert s.embedding_model == "BAAI/bge-m3"
|
||||
assert s.embedding_dim == 1024
|
||||
|
||||
|
||||
def test_settings_env_override(monkeypatch: object) -> None:
|
||||
"""DATABASE_URL env var overrides the default database_url."""
|
||||
import pytest
|
||||
|
||||
mp: pytest.MonkeyPatch = monkeypatch # type: ignore[assignment]
|
||||
mp.setenv("DATABASE_URL", "postgresql://x:y@h:5432/db")
|
||||
s = Settings()
|
||||
assert s.database_url == "postgresql://x:y@h:5432/db"
|
||||
|
||||
|
||||
def test_get_settings_is_singleton() -> None:
|
||||
"""get_settings() returns the same object on repeated calls; new object after cache_clear."""
|
||||
get_settings.cache_clear()
|
||||
first = get_settings()
|
||||
second = get_settings()
|
||||
assert first is second
|
||||
|
||||
get_settings.cache_clear()
|
||||
third = get_settings()
|
||||
assert third is not first
|
||||
Reference in New Issue
Block a user