tests/conftest.py
tests/conftest.pyBrowse 33 files
391 tokens
1,528 bytes
Token encoding: o200k_base
Snapshot 24fd22b
← Back to SKILL.md
1"""Pytest configuration for the comfyui skill test suite.2 3Adds `scripts/` to sys.path so tests can `from _common import ...`, and4provides a few common fixtures.5"""6 7from __future__ import annotations8 9import json10import os11import sys12from pathlib import Path13 14import pytest15 16ROOT = Path(__file__).resolve().parent.parent17SCRIPTS = ROOT / "scripts"18WORKFLOWS = ROOT / "workflows"19 20sys.path.insert(0, str(SCRIPTS))21 22 23@pytest.fixture24def sd15_workflow() -> dict:25 return json.loads((WORKFLOWS / "sd15_txt2img.json").read_text(encoding="utf-8"))26 27 28@pytest.fixture29def flux_workflow() -> dict:30 return json.loads((WORKFLOWS / "flux_dev_txt2img.json").read_text(encoding="utf-8"))31 32 33@pytest.fixture34def video_workflow() -> dict:35 return json.loads((WORKFLOWS / "wan_video_t2v.json").read_text(encoding="utf-8"))36 37 38@pytest.fixture39def workflows_dir() -> Path:40 return WORKFLOWS41 42 43@pytest.fixture44def scripts_dir() -> Path:45 return SCRIPTS46 47 48@pytest.fixture49def cloud_key() -> str | None:50 """Cloud API key if set, otherwise None.51 52 Tests that need cloud connectivity should skip when this is None.53 """54 return os.environ.get("COMFY_CLOUD_API_KEY")55 56 57def pytest_collection_modifyitems(config, items):58 """Auto-skip cloud tests when no API key is set."""59 if os.environ.get("COMFY_CLOUD_API_KEY"):60 return61 skip_cloud = pytest.mark.skip(reason="Set COMFY_CLOUD_API_KEY to run cloud tests")62 for item in items:63 if "cloud" in item.keywords:64 item.add_marker(skip_cloud)65