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>
26 lines
550 B
Python
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()
|