import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) import httpx import pytest import config @pytest.fixture def datenordner(tmp_path, monkeypatch): """Leitet DATEN_DIR auf einen frischen Ordner um.""" ordner = tmp_path / "daten" ordner.mkdir() monkeypatch.setattr(config, "DATEN_DIR", ordner) return ordner @pytest.fixture async def client(datenordner): from server import app transport = httpx.ASGITransport(app=app) async with httpx.AsyncClient(transport=transport, base_url="http://test") as c: yield c