feat(family): deploy Single-Writer DuckDB backend, Mila parent cockpit & feeding analytics, and Moritz macro tracker
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import os
|
||||
import shutil
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
import pytest
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from app.config import DATA_DIR
|
||||
from app.engine import DuckDBEngine
|
||||
from app.git_sync import GitSyncManager
|
||||
from app.main import app
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def test_data_dir():
|
||||
# Use real wiki data dir if exists, else temporary copy
|
||||
if DATA_DIR.is_dir():
|
||||
yield DATA_DIR
|
||||
else:
|
||||
temp_dir = Path(tempfile.mkdtemp())
|
||||
yield temp_dir
|
||||
shutil.rmtree(temp_dir, ignore_errors=True)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def engine(test_data_dir):
|
||||
return DuckDBEngine(data_dir=test_data_dir)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def client(engine):
|
||||
app.state.engine = engine
|
||||
app.state.git_sync = GitSyncManager(wiki_dir=engine.data_dir.parent)
|
||||
with TestClient(app) as c:
|
||||
yield c
|
||||
Reference in New Issue
Block a user