The upstream locales/zh/nodeDefs.json is not part of this repository, so every test reading it failed at runtime. Guard all 16 call sites with pytest.skip and add a tests/conftest.py that stubs folder_paths so collection works outside a full ComfyUI installation.
33 lines
1.1 KiB
Python
33 lines
1.1 KiB
Python
"""Test-time stubs so the suite can run outside a full ComfyUI installation.
|
|
|
|
Every stub is installed only when the real module is NOT importable, so this
|
|
file has no effect when tests run inside an environment that has ComfyUI on
|
|
sys.path.
|
|
"""
|
|
|
|
import importlib.util
|
|
import sys
|
|
import types
|
|
|
|
|
|
def _module_available(name: str) -> bool:
|
|
try:
|
|
return importlib.util.find_spec(name) is not None
|
|
except (ImportError, ValueError, ModuleNotFoundError):
|
|
return False
|
|
|
|
|
|
if not _module_available("folder_paths"):
|
|
folder_paths = types.ModuleType("folder_paths")
|
|
folder_paths.models_dir = ""
|
|
folder_paths.base_path = ""
|
|
folder_paths.get_folder_paths = lambda *a, **k: []
|
|
folder_paths.get_filename_list = lambda *a, **k: []
|
|
folder_paths.get_full_path = lambda *a, **k: None
|
|
folder_paths.get_directory_by_type = lambda *a, **k: None
|
|
folder_paths.get_output_directory = lambda *a, **k: None
|
|
folder_paths.get_temp_directory = lambda *a, **k: None
|
|
folder_paths.get_input_directory = lambda *a, **k: None
|
|
folder_paths.get_save_image_path = lambda *a, **k: ("", "", 0, "", "")
|
|
sys.modules["folder_paths"] = folder_paths
|