Ported from v4, minus two mechanisms that are no longer needed. The LoRA loader takes one LoRA and chains, so the FlexibleOptionalInputType dict subclass that lied to ComfyUI's validator has nothing left to do. The CLIP loader uses numbered slots like core's DualCLIPLoader instead of a JSON array in a string widget. Autogrow looked like the right answer for the encoder list and is not: it sets force_input on any widget input, so a list of combos renders as sockets and the file picker stops being a picker. Every core use of it is a connection type. GGUF and SLA are deliberately not here. Both are capabilities rather than loader options, and both belong in modules of their own. The tests follow what the loaders PRODUCE rather than stopping at the call: the attention override is carried into comfy's real dispatch and checked against every backend this machine registers, because an override that only fails at the first attention call fails at sampling, not at load. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
39 lines
1.0 KiB
Python
39 lines
1.0 KiB
Python
"""Shared test setup for the whole tree.
|
|
|
|
Kept at the root so `modules/**/tests` get the same fixtures as `core/tests`
|
|
without each one re-deriving the path to ComfyUI.
|
|
"""
|
|
|
|
import os
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
ROOT = Path(__file__).resolve().parent
|
|
if str(ROOT) not in sys.path:
|
|
sys.path.insert(0, str(ROOT))
|
|
|
|
|
|
def _comfyui_root():
|
|
candidates = [os.environ.get("COMFYUI_ROOT"), str(Path.home() / "Documents" / "ComfyUI")]
|
|
for candidate in candidates:
|
|
if candidate and (Path(candidate) / "comfy" / "supported_models.py").is_file():
|
|
if candidate not in sys.path:
|
|
sys.path.append(candidate)
|
|
return candidate
|
|
return None
|
|
|
|
|
|
@pytest.fixture(scope="session")
|
|
def comfyui():
|
|
"""ComfyUI's source tree on sys.path, or skip.
|
|
|
|
Everything that touches a node schema needs it, because a schema is only
|
|
meaningful in terms of comfy_api's own types.
|
|
"""
|
|
root = _comfyui_root()
|
|
if root is None:
|
|
pytest.skip("no ComfyUI source on this machine")
|
|
return root
|