Files
ohm_streaming/tests/conftest.py
T
Roman 41566ab5fb v0.1.0 — Réécriture complète de OhmStreaming
Nouvelle version réécrite de zéro : recherche multi-sources (Vostfree,
French-Manga), extraction 2 niveaux, proxy vidéo intégré, streaming/téléchargement
HLS, métadonnées Kitsu, bibliothèque locale, comptes JWT + administration,
découverte fusionnée, indexeur Torznab (Sonarr/Prowlarr).
2026-09-22 10:05:47 +00:00

41 lines
1003 B
Python

import os
import tempfile
from collections.abc import AsyncIterator
from pathlib import Path
import pytest
# Environnement de test AVANT tout import de l'app
_tmp = Path(tempfile.mkdtemp(prefix="ohm-test-"))
os.environ["OHM_DATA_DIR"] = str(_tmp)
os.environ["OHM_DOWNLOAD_DIR"] = str(_tmp / "downloads")
os.environ["OHM_DATABASE_PATH"] = str(_tmp / "test.db")
os.environ["OHM_SECRET_KEY"] = "test-secret-key-with-32-bytes-minimum!"
from app.config import get_settings
from app.db import db
@pytest.fixture(scope="session")
def anyio_backend() -> str:
return "asyncio"
@pytest.fixture(autouse=True)
async def database() -> AsyncIterator[None]:
"""DB fraîche par test."""
get_settings.cache_clear()
await db.connect()
for table in (
"users",
"refresh_tokens",
"downloads",
"metadata_cache",
"settings",
"favorites",
"watch_progress",
):
await db.execute(f"DELETE FROM {table}")
yield
await db.close()