Files
netmover/tests/conftest.py
T
Florian WildeandClaude Opus 5.5 a60daf0039 feat: Projektgerüst, Datenmodell und initiale Migration
Schritt 1: src-Layout mit FastAPI-Stack, SQLAlchemy-2.x-Modell inkl.
Buchführung für Kopiermodus und Quarantäne, Alembic-Migration 0001,
strukturierte Logs, CLI (migrate/version), Changelog und Devlog.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 17:25:42 +02:00

26 lines
550 B
Python

from __future__ import annotations
from collections.abc import Iterator
from pathlib import Path
import pytest
from sqlalchemy.orm import Session
from netmover.db import make_engine, make_session_factory, upgrade
@pytest.fixture
def db_url(tmp_path: Path) -> str:
url = f"sqlite:///{tmp_path / 'test.db'}"
upgrade(url)
return url
@pytest.fixture
def session(db_url: str) -> Iterator[Session]:
engine = make_engine(db_url)
factory = make_session_factory(engine)
with factory() as s:
yield s
engine.dispose()