Milestone 3

This commit is contained in:
Knacky
2026-05-11 06:05:27 +02:00
commit 4c25e198fc
125 changed files with 13489 additions and 0 deletions

25
backend/tests/conftest.py Normal file
View File

@@ -0,0 +1,25 @@
"""Shared pytest fixtures.
The DB integration tests need a reachable Postgres on the URL configured in
`app.core.config.settings`. They are skipped automatically when the DB isn't up,
so unit tests still pass on a developer's bare laptop.
"""
from __future__ import annotations
import pytest
from sqlalchemy.exc import OperationalError
from app.db.session import get_engine
@pytest.fixture(scope="session")
def db_engine_or_skip():
"""Yield the SQLAlchemy engine, skipping the test if the DB is unreachable."""
engine = get_engine()
try:
with engine.connect() as conn:
conn.execute.__self__ # touch the connection
except OperationalError as e:
pytest.skip(f"Postgres unreachable: {e}", allow_module_level=False)
return engine