Files
aigc-home/calliope-backend/tests/conftest.py
T
总工andmultica-agent e3bfe771af feat(workflows): manual output-node mapping for unknown custom outputs (HEL-638)
Unknown custom output nodes are never auto-typed by class-name semantics;
they stay pending until the user designates the real output node(s) and
media type. Picking a usage alone no longer enables a workflow, reanalyze/
migration/field edits never overwrite a user mapping, generation harvests
only the mapped nodes from ComfyUI history, and media-type mismatches or
missing node results fail for real instead of faking completion.

Co-authored-by: multica-agent <github@multica.ai>
2026-09-29 14:44:37 +08:00

45 lines
1.4 KiB
Python

from __future__ import annotations
import asyncio
import tempfile
from pathlib import Path
import pytest
from fastapi.testclient import TestClient
from calliope.db import migrate_db
from calliope.main import create_app
# Shared fake-ComfyUI HTTP server (defined in test_studio_generation,
# reused by the generation / status / unknown-output-mapping suites).
from tests.test_studio_generation import fake_comfy # noqa: F401,E402
@pytest.fixture
def client(monkeypatch):
with tempfile.TemporaryDirectory() as tmpdir:
import calliope.config as config_module
# Mutate singleton in place so all `from calliope.config import settings` refs update
s = config_module.settings
prev = {
"data_dir": s.data_dir,
"assets_dir": s.assets_dir,
"dry_run": s.dry_run,
"queue_poll_interval_sec": s.queue_poll_interval_sec,
}
s.data_dir = Path(tmpdir)
s.assets_dir = Path(tmpdir) / "assets"
s.dry_run = True
s.queue_poll_interval_sec = 0.5
# Never persist temp test paths into the real calliope_config.json
monkeypatch.setattr(config_module.Settings, "save_config_file", lambda self: None)
asyncio.run(migrate_db(s.db_path))
app = create_app()
try:
with TestClient(app) as c:
yield c
finally:
for k, v in prev.items():
setattr(s, k, v)