From d87611c035cc68cab18a735fe9a01c8663d6e05f Mon Sep 17 00:00:00 2001 From: Peyton DeNiro <25550995+pydn@users.noreply.github.com> Date: Sat, 28 Mar 2026 16:33:11 -0500 Subject: [PATCH] Fix runtime validation entrypoint and export test --- tests/runtime/run_runtime_validation.py | 4 ++-- tests/test_upscale_model_loader_export.py | 26 ++++++++++++++++++++++- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/tests/runtime/run_runtime_validation.py b/tests/runtime/run_runtime_validation.py index 6770baf..46b0d84 100644 --- a/tests/runtime/run_runtime_validation.py +++ b/tests/runtime/run_runtime_validation.py @@ -13,8 +13,6 @@ from io import StringIO from pathlib import Path from typing import Callable -from comfyui_to_python_utils import get_comfyui_path - ROOT = Path(__file__).resolve().parents[2] FIXTURE_DIR = ROOT / "tests" / "fixtures" / "runtime" GENERATED_DIR = ROOT / "tests" / "runtime" / "generated" @@ -24,6 +22,8 @@ COMFYUI_INPUT_DIRNAME = "input" if str(ROOT) not in sys.path: sys.path.insert(0, str(ROOT)) +from comfyui_to_python_utils import get_comfyui_path + class ValidationFailure(RuntimeError): def __init__(self, classification: str, message: str): diff --git a/tests/test_upscale_model_loader_export.py b/tests/test_upscale_model_loader_export.py index 7beed03..90827c9 100644 --- a/tests/test_upscale_model_loader_export.py +++ b/tests/test_upscale_model_loader_export.py @@ -95,7 +95,7 @@ class UpscaleModelLoaderExportTest(unittest.TestCase): generated = output.getvalue() self.assertIn("from nodes import NODE_CLASS_MAPPINGS", generated) - self.assertIn("from tests.test_upscale_model_loader_export import (", generated) + self.assertIn(f"from {LoadImage.__module__} import (", generated) self.assertIn("LoadImage,", generated) self.assertIn("UpscaleModelLoader,", generated) self.assertIn("ImageUpscaleWithModel,", generated) @@ -145,6 +145,30 @@ class UpscaleModelLoaderExportTest(unittest.TestCase): self.assertIn('"nodes": []', generated) self.assertNotIn('"source": "workflow_api"', generated) + def test_export_without_frontend_workflow_leaves_png_workflow_metadata_absent(self): + workflow = { + "1": { + "class_type": "LoadImage", + "inputs": { + "image": "example.png", + }, + } + } + + output = StringIO() + ComfyUItoPython( + workflow=json.dumps(workflow), + output_file=output, + node_class_mappings={ + "LoadImage": LoadImage, + }, + ) + + generated = output.getvalue() + + self.assertIn("extra_pnginfo = None", generated) + self.assertNotIn('"workflow": json.loads(', generated) + def test_run_accepts_frontend_workflow_file_for_cli_metadata(self): workflow = { "1": {