This commit is contained in:
team3
2026-07-10 15:43:11 +02:00
commit 0a41166cca
72 changed files with 7772 additions and 0 deletions

33
tests/conftest.py Normal file
View File

@@ -0,0 +1,33 @@
import sys
from pathlib import Path
import pytest
sys.path.insert(0, str(Path(__file__).resolve().parent.parent / "backend"))
import db # noqa: E402
import embedding # noqa: E402
import korpus # noqa: E402
@pytest.fixture(autouse=True)
def fake_welt(tmp_path, monkeypatch):
"""Jeder Test: frische In-Memory-DB, Fake-Agenten, Korpus/Topics in tmp.
Embedding fest auf Jaccard-Fallback — kein Modell-Download, deterministisch."""
monkeypatch.setenv("CREATOR_FAKE_AGENTS", "1")
monkeypatch.setattr(embedding, "_geladen", True)
monkeypatch.setattr(embedding, "_modell", None)
monkeypatch.setattr(korpus, "KORPUS_DIR", tmp_path / "korpus")
monkeypatch.setattr(korpus, "TOPICS_DIR", tmp_path / "topics")
db.on_change = None
db.reset_for_tests(":memory:")
yield tmp_path
def topic_anlegen(name="fake-thema", art="thema"):
db.insert("topics", name=name, titel=name, art=art, provider="minimax")
return name
def run_anlegen(topic, budget=0):
return db.insert("runs", topic=topic, status="running", budget_tokens=budget)