import importlib import pytest from fastapi.testclient import TestClient @pytest.fixture def client(tmp_path, monkeypatch): monkeypatch.setenv("WORKSPACE_ROOT", str(tmp_path)) monkeypatch.setenv("AUTH_ENABLED", "false") monkeypatch.setenv("AUTH_DATABASE_PATH", str(tmp_path / "auth.db")) monkeypatch.delenv("EDITOR_API_KEY", raising=False) monkeypatch.delenv("BOOTSTRAP_ADMIN_USERNAME", raising=False) monkeypatch.delenv("BOOTSTRAP_ADMIN_PASSWORD", raising=False) import editor_app.config as config import editor_app.db.session as db_sess import editor_app.main as main config.WORKSPACE_ROOT = tmp_path db_sess.reset_engine() importlib.reload(main) with TestClient(main.app) as test_client: yield test_client