26 lines
900 B
Python
26 lines
900 B
Python
"""Pytest config + fixtures."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
|
|
# Use test env vars before importing anything app-related
|
|
os.environ.setdefault("DATABASE_URL", "postgresql+asyncpg://airpg:airpg@localhost:5432/airpg_test")
|
|
os.environ.setdefault("QDRANT_URL", "http://localhost:6333")
|
|
os.environ.setdefault("LLM_API_URL", "") # forces MockLlmClient
|
|
os.environ.setdefault("SECRET_KEY", "test-secret-key-32-bytes-long-required")
|
|
os.environ.setdefault("DEBUG", "true")
|
|
|
|
import pytest
|
|
|
|
|
|
def pytest_collection_modifyitems(config, items):
|
|
"""Auto-mark async tests with pytest.mark.asyncio."""
|
|
for item in items:
|
|
if "asyncio" in item.keywords:
|
|
continue
|
|
# If the test function is a coroutine function, auto-add the asyncio marker
|
|
import inspect
|
|
if inspect.iscoroutinefunction(item.function):
|
|
item.add_marker(pytest.mark.asyncio)
|