mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-28 23:30:16 +08:00
fix tests, make fixture of core workflow test function to reclaim RAM better
This commit is contained in:
parent
f54af2c7ff
commit
358cb834d6
@ -159,7 +159,7 @@ class FrontendManager:
|
|||||||
@classmethod
|
@classmethod
|
||||||
def get_required_templates_version(cls) -> str:
|
def get_required_templates_version(cls) -> str:
|
||||||
# returns a stub, since this isn't a helpful check in this environment
|
# returns a stub, since this isn't a helpful check in this environment
|
||||||
return "0.0.1"
|
return "0.1.95"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def default_frontend_path(cls) -> str:
|
def default_frontend_path(cls) -> str:
|
||||||
|
|||||||
@ -155,8 +155,6 @@ SENSITIVE_EXTRA_DATA_KEYS = ("auth_token_comfy_org", "api_key_comfy_org")
|
|||||||
def get_input_data(inputs, class_def, unique_id, execution_list=None, dynprompt=None, extra_data=None):
|
def get_input_data(inputs, class_def, unique_id, execution_list=None, dynprompt=None, extra_data=None):
|
||||||
if extra_data is None:
|
if extra_data is None:
|
||||||
extra_data = {}
|
extra_data = {}
|
||||||
if outputs is None:
|
|
||||||
outputs = {}
|
|
||||||
is_v3 = issubclass(class_def, _ComfyNodeInternal)
|
is_v3 = issubclass(class_def, _ComfyNodeInternal)
|
||||||
if is_v3:
|
if is_v3:
|
||||||
valid_inputs, schema = class_def.INPUT_TYPES(include_hidden=False, return_schema=True)
|
valid_inputs, schema = class_def.INPUT_TYPES(include_hidden=False, return_schema=True)
|
||||||
|
|||||||
@ -81,7 +81,7 @@ try:
|
|||||||
if torch.backends.cudnn.version() >= 91002 and model_management.torch_version_numeric >= (2, 9) and model_management.torch_version_numeric <= (2, 10):
|
if torch.backends.cudnn.version() >= 91002 and model_management.torch_version_numeric >= (2, 9) and model_management.torch_version_numeric <= (2, 10):
|
||||||
# TODO: change upper bound version once it's fixed'
|
# TODO: change upper bound version once it's fixed'
|
||||||
NVIDIA_MEMORY_CONV_BUG_WORKAROUND = True
|
NVIDIA_MEMORY_CONV_BUG_WORKAROUND = True
|
||||||
logger.info("working around nvidia conv3d memory bug.")
|
logger.debug("working around nvidia conv3d memory bug.")
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
@ -64,7 +64,7 @@ class LTXVImgToVideo(io.ComfyNode):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def execute(cls, positive, negative, image, vae, width, height, length, batch_size, strength) -> io.NodeOutput:
|
def execute(cls, positive, negative, image, vae, width, height, length, batch_size, strength=1.0) -> io.NodeOutput:
|
||||||
pixels = comfy.utils.common_upscale(image.movedim(-1, 1), width, height, "bilinear", "center").movedim(1, -1)
|
pixels = comfy.utils.common_upscale(image.movedim(-1, 1), width, height, "bilinear", "center").movedim(1, -1)
|
||||||
encode_pixels = pixels[:, :, :, :3]
|
encode_pixels = pixels[:, :, :, :3]
|
||||||
t = vae.encode(encode_pixels)
|
t = vae.encode(encode_pixels)
|
||||||
|
|||||||
@ -12,7 +12,7 @@ from comfy_extras.nodes.nodes_audio import TorchAudioNotFoundError
|
|||||||
from . import workflows
|
from . import workflows
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="module", autouse=False)
|
@pytest.fixture(scope="function", autouse=False)
|
||||||
async def client(tmp_path_factory) -> Comfy:
|
async def client(tmp_path_factory) -> Comfy:
|
||||||
async with Comfy() as client:
|
async with Comfy() as client:
|
||||||
yield client
|
yield client
|
||||||
|
|||||||
@ -207,6 +207,7 @@ numpy"""
|
|||||||
assert version is None
|
assert version is None
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.skip("not used in this fork")
|
||||||
def test_get_templates_version():
|
def test_get_templates_version():
|
||||||
# Arrange
|
# Arrange
|
||||||
expected_version = "0.1.41"
|
expected_version = "0.1.41"
|
||||||
@ -224,7 +225,7 @@ numpy"""
|
|||||||
# Assert
|
# Assert
|
||||||
assert version == expected_version
|
assert version == expected_version
|
||||||
|
|
||||||
|
@pytest.mark.skip("not used in this fork")
|
||||||
def test_get_templates_version_not_found():
|
def test_get_templates_version_not_found():
|
||||||
# Arrange
|
# Arrange
|
||||||
mock_requirements_content = """torch
|
mock_requirements_content = """torch
|
||||||
@ -240,7 +241,7 @@ numpy"""
|
|||||||
# Assert
|
# Assert
|
||||||
assert version is None
|
assert version is None
|
||||||
|
|
||||||
|
@pytest.mark.skip("not used in this fork")
|
||||||
def test_get_templates_version_invalid_semver():
|
def test_get_templates_version_invalid_semver():
|
||||||
# Arrange
|
# Arrange
|
||||||
mock_requirements_content = """torch
|
mock_requirements_content = """torch
|
||||||
@ -256,7 +257,7 @@ numpy"""
|
|||||||
# Assert
|
# Assert
|
||||||
assert version is None
|
assert version is None
|
||||||
|
|
||||||
|
@pytest.mark.skip("not used in this fork")
|
||||||
def test_get_installed_templates_version():
|
def test_get_installed_templates_version():
|
||||||
# Arrange
|
# Arrange
|
||||||
expected_version = "0.1.40"
|
expected_version = "0.1.40"
|
||||||
@ -268,7 +269,7 @@ def test_get_installed_templates_version():
|
|||||||
# Assert
|
# Assert
|
||||||
assert version == expected_version
|
assert version == expected_version
|
||||||
|
|
||||||
|
@pytest.mark.skip("not used in this fork")
|
||||||
def test_get_installed_templates_version_not_installed():
|
def test_get_installed_templates_version_not_installed():
|
||||||
# Act
|
# Act
|
||||||
with patch("app.frontend_management.version", side_effect=Exception("Package not found")):
|
with patch("app.frontend_management.version", side_effect=Exception("Package not found")):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user