Files
EwaldandClaude Sonnet 5 019a5c9172 Load through comfy_entrypoint and adopt current ComfyUI APIs
Defining NODE_CLASS_MAPPINGS made ComfyUI skip comfy_entrypoint, so
/imageops/viewmedia and node replacements were never registered. Load
as a V3 extension only, move server.py to routes.py so it stops
shadowing ComfyUI's server module, and transcode animated previews
with PyAV instead of an external ffmpeg.

- Require ComfyUI 0.19.0 (has_intermediate_output); CI floor updated.
- Process 11 nodes on ComfyUI's torch device when the frames fit in
  free memory (IMAGEOPS_COMPUTE_DEVICE=cpu disables it).
- Add core CURVE input to Color Correct, BOUNDING_BOX output/input to
  Crop and Crop Stitch, LAYERS output to Comp (ComfyUI 0.31+),
  essentials_category, and Merge blend modes with golden parity.
- Report progress through the public set_progress API and drop the
  hidden unique_id input.
- Add ImageOps settings and a refresh-previews command.
- Fix ImageOpsComp rotation and preview saving (undefined
  to_display_range) and masked Transform edge colors.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-28 14:53:14 +02:00

69 lines
1.6 KiB
Python

"""Integration-test bootstrap for a real ComfyUI checkout."""
from __future__ import annotations
import importlib.util
import os
import sys
from pathlib import Path
import pytest
COMFYUI_ROOT = Path(
os.environ.get("COMFYUI_ROOT", "/tmp/ComfyUI")
).resolve()
EXTENSION_ROOT = Path(
os.environ.get(
"IMAGEOPS_EXTENSION_ROOT",
COMFYUI_ROOT / "custom_nodes" / "ComfyUI-Majoor-ImageOps",
)
).resolve()
# Important:
# ComfyUI is cloned, not installed as a normal Python package.
# Therefore comfy_api, folder_paths, server, etc. need the ComfyUI
# repository root on sys.path.
if str(COMFYUI_ROOT) not in sys.path:
sys.path.insert(0, str(COMFYUI_ROOT))
# Importing ComfyUI's server initializes the torch device; tests run on CPU.
from comfy.cli_args import args as comfy_args # noqa: E402
comfy_args.cpu = True
@pytest.fixture(scope="session")
def imageops_extension():
"""Load ImageOps exactly from ComfyUI/custom_nodes."""
init_file = EXTENSION_ROOT / "__init__.py"
assert COMFYUI_ROOT.is_dir(), (
f"COMFYUI_ROOT does not exist: {COMFYUI_ROOT}"
)
assert init_file.is_file(), (
f"ImageOps extension was not copied correctly: {init_file}"
)
module_name = "imageops_ci_extension"
spec = importlib.util.spec_from_file_location(
module_name,
init_file,
submodule_search_locations=[str(EXTENSION_ROOT)],
)
assert spec is not None
assert spec.loader is not None
module = importlib.util.module_from_spec(spec)
sys.modules[module_name] = module
spec.loader.exec_module(module)
return module