Add the scoped PostgreSQL/pgvector schema, independent ingestion settings and ports, embedding profile checks, and trusted administrator bootstrap. Include repository contracts and guidance, organized provider-free and PostgreSQL tests, deployment setup, and byte-preserving migration attributes. Validation: 163 tests passed; all 48 PostgreSQL cases passed with pgvector Python 0.5.0 and 0.3.6. No production schema or historical metadata was changed.
27 lines
915 B
Python
27 lines
915 B
Python
"""Shared settings isolation and pytest acceptance option."""
|
|
import os
|
|
import pytest
|
|
from app.modules.documents.settings import IngestionSettings
|
|
|
|
|
|
def pytest_addoption(parser):
|
|
parser.addoption("--require-postgres", action="store_true",
|
|
help="Fail rather than skip when TEST_DATABASE_URL is missing")
|
|
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def isolated_ingestion_environment(monkeypatch):
|
|
"""Each test starts without deployment overrides; explicit env tests set their own."""
|
|
for name in tuple(os.environ):
|
|
if name.upper().startswith("INGEST_"):
|
|
monkeypatch.delenv(name)
|
|
|
|
|
|
@pytest.fixture
|
|
def settings():
|
|
return IngestionSettings(
|
|
_env_file=None, database_url="postgresql+psycopg://unused/unused",
|
|
embedding_provider="test", embedding_endpoint="https://test.invalid/v1",
|
|
embedding_model="deterministic-test", embedding_dimensions=3,
|
|
)
|