最新のComfyUIにおける実行エンジンのリスト自動アンラップ廃止に伴い、リスト型ノードの出力データが下流ノードで二重にラップされて正常に結合できなくなる不具合を解消するため、およびE2Eテスト環境の不整合を修正 - StringToolsRandomChoiceList、StringToolsBalancedChoiceList、StringToolsConcatList の process 戻り値から不要なリストブラケットを削除 - test_string_tools_complex_interconnection において seed と text_list の接続ポートが逆になっていた不具合を修正 - テスト内モックノード StringToolsMockStringList をテスト実行環境(COMFYUI_TEST_MODE または pytest 稼働中)のみ動的に登録するように制御 - モックノード誤露出時のフェイルセーフとして NODE_DISPLAY_NAME_MAPPINGS にテスト用である旨の表示名を設定 - conftest.py の起動オプションにホワイトリストを追加しテスト実行速度を高速化
55 lines
1.5 KiB
Python
55 lines
1.5 KiB
Python
import pytest
|
|
import sys
|
|
import os
|
|
import importlib.util
|
|
|
|
spec = importlib.util.spec_from_file_location("comfyui_string_tools", os.path.join(os.path.dirname(__file__), "..", "__init__.py"))
|
|
comfy_module = importlib.util.module_from_spec(spec)
|
|
sys.modules["comfyui_string_tools"] = comfy_module
|
|
spec.loader.exec_module(comfy_module)
|
|
|
|
get_node = comfy_module.get_node
|
|
# Will add count_node_occurrences later
|
|
|
|
def test_workflow_traversal():
|
|
workflow = {
|
|
"nodes": [
|
|
{
|
|
"id": 1,
|
|
"type": "StringToolsString",
|
|
"inputs": [{"name": "text"}],
|
|
"widgets_values": ["Apple"]
|
|
},
|
|
{
|
|
"id": 2,
|
|
"type": "StringToolsString",
|
|
"widgets_values": ["Banana"]
|
|
},
|
|
{
|
|
"id": 10,
|
|
"type": "StringToolsBalancedChoiceList",
|
|
"inputs": [
|
|
{"name": "text_list", "type": "STRING", "link": 100}
|
|
]
|
|
},
|
|
{
|
|
"id": 20,
|
|
"type": "MockListCreator",
|
|
"inputs": [
|
|
{"name": "text_0", "link": 1}
|
|
]
|
|
}
|
|
],
|
|
"links": [
|
|
[1, 1, 0, 20, 0, "STRING"]
|
|
]
|
|
}
|
|
kwargs = {
|
|
"text_list": ["Apple"],
|
|
"extra_pnginfo": {"workflow": workflow},
|
|
"unique_id": "10"
|
|
}
|
|
|
|
node = get_node(kwargs)
|
|
assert node["id"] == 10
|