Tests: route tests get stand-in model files so a machine without models still sees a deleted file; optional-slot list follows the two LTX presets
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BzJLJWVu7RZnbRqm3nYAnX
This commit is contained in:
@@ -4,7 +4,7 @@ and for a render. Each must answer JSON: a page that gets anything else fails on
|
||||
|
||||
import pytest
|
||||
|
||||
from core.tests.test_routes_pipeline import _request, registered, server # noqa: F401
|
||||
from core.tests.test_routes_pipeline import _request, model_files, registered, server # noqa: F401
|
||||
|
||||
|
||||
def _preset(pid):
|
||||
|
||||
@@ -20,7 +20,22 @@ from core import routes # noqa: E402
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def registered(comfyui):
|
||||
def model_files(comfyui, tmp_path_factory):
|
||||
"""One empty file in each folder a default loader reads, so the loaders' dropdowns have something to offer.
|
||||
|
||||
A machine without models (a cloud test run) would otherwise report "nothing fills it" for every loader, and a
|
||||
test that deletes ONE file could not tell its own problem from that. The nodes read their options when they
|
||||
register, so this comes before `registered`."""
|
||||
import folder_paths
|
||||
root = tmp_path_factory.mktemp("models")
|
||||
for kind in ("diffusion_models", "vae", "text_encoders", "clip", "loras"):
|
||||
(root / kind).mkdir()
|
||||
(root / kind / "stand-in.safetensors").write_bytes(b"\0")
|
||||
folder_paths.add_model_folder_path(kind, str(root / kind))
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def registered(comfyui, model_files):
|
||||
"""FunUI's nodes registered the way ComfyUI registers them.
|
||||
|
||||
Without this the pipeline's slots all look like missing nodes, because the
|
||||
|
||||
@@ -44,10 +44,11 @@ def _cases():
|
||||
return [(preset["id"], slot["id"]) for preset in _presets() for slot in preset["slots"] if slot["node"] in table]
|
||||
|
||||
|
||||
def test_the_seven_optional_node_classes_are_declared():
|
||||
def test_the_optional_node_classes_the_presets_use_are_declared():
|
||||
# FunUIIdentityTransfer is still declared (LTX pipelines saved with it keep running) but no preset carries it any more.
|
||||
nodes = {s["node"] for p in _presets() for s in p["slots"] if s["node"] in _table()}
|
||||
assert nodes == {"FunUIEnhancePrompt", "FunUIShotCamera", "FunUIPromptMarkup", "FunUIApplyPromptMarkup",
|
||||
"FunUINegativeErase", "FunUICutOpening", "FunUIIdentityTransfer"}
|
||||
"FunUINegativeErase", "FunUICutOpening"}
|
||||
|
||||
|
||||
@pytest.mark.parametrize("preset_id,slot_id", _cases())
|
||||
|
||||
@@ -13,7 +13,7 @@ import torch
|
||||
|
||||
pytest.importorskip("aiohttp")
|
||||
|
||||
from core.tests.test_routes_pipeline import _request, registered, server # noqa: E402,F401
|
||||
from core.tests.test_routes_pipeline import _request, model_files, registered, server # noqa: E402,F401
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
|
||||
Reference in New Issue
Block a user