Moxie-Multimedia / tests /conftest.py
turtle89431's picture
Upload folder using huggingface_hub (part 2)
3afd6d6 verified
Raw History Blame Contribute Delete
1.17 kB
"""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