Fix runtime validation entrypoint and export test

This commit is contained in:
Peyton DeNiro
2026-03-28 16:33:11 -05:00
parent 893c76d6cc
commit d87611c035
2 changed files with 27 additions and 3 deletions
+2 -2
View File
@@ -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):
+25 -1
View File
@@ -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": {