mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-11-19 12:07:02 +08:00
80 lines
1.5 KiB
Python
80 lines
1.5 KiB
Python
from comfy.cli_args import ComfyConfigLoader
|
|
|
|
|
|
def test_defaults():
|
|
config = "{}"
|
|
argv = []
|
|
|
|
args = ComfyConfigLoader().parse_args_with_string(config, argv)
|
|
|
|
assert args.listen == "127.0.0.1"
|
|
assert args.novram == False
|
|
|
|
|
|
def test_config():
|
|
config = """
|
|
config:
|
|
network:
|
|
listen: 0.0.0.0
|
|
"""
|
|
argv = []
|
|
|
|
args = ComfyConfigLoader().parse_args_with_string(config, argv)
|
|
|
|
assert args.listen == "0.0.0.0"
|
|
|
|
|
|
def test_cli_args_overrides_config():
|
|
config = """
|
|
config:
|
|
network:
|
|
listen: 0.0.0.0
|
|
"""
|
|
argv = ["--listen", "192.168.1.100"]
|
|
|
|
args = ComfyConfigLoader().parse_args_with_string(config, argv)
|
|
|
|
assert args.listen == "192.168.1.100"
|
|
|
|
|
|
def test_config_enum():
|
|
config = """
|
|
config:
|
|
pytorch:
|
|
cross_attention: split
|
|
"""
|
|
argv = []
|
|
|
|
args = ComfyConfigLoader().parse_args_with_string(config, argv)
|
|
|
|
assert args.use_split_cross_attention is True
|
|
assert args.use_pytorch_cross_attention is False
|
|
|
|
|
|
def test_config_enum_default():
|
|
config = """
|
|
config:
|
|
pytorch:
|
|
cross_attention:
|
|
"""
|
|
argv = []
|
|
|
|
args = ComfyConfigLoader().parse_args_with_string(config, argv)
|
|
|
|
assert args.use_split_cross_attention is False
|
|
assert args.use_pytorch_cross_attention is False
|
|
|
|
|
|
def test_config_enum_exclusive():
|
|
config = """
|
|
config:
|
|
pytorch:
|
|
cross_attention: split
|
|
"""
|
|
argv = ["--use-pytorch-cross-attention"]
|
|
|
|
args = ComfyConfigLoader().parse_args_with_string(config, argv)
|
|
|
|
assert args.use_split_cross_attention is False
|
|
assert args.use_pytorch_cross_attention is True
|