mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-09-07 19:37:02 +08:00
[fix] Improve CI compatibility by mocking nodes module import
Prevent CUDA initialization chain by mocking the nodes module at import time, which is cleaner than deep mocking of CUDA-specific functions.
This commit is contained in:
parent
97b089dc95
commit
b8712f2494
@ -1,15 +1,17 @@
|
|||||||
import torch
|
import torch
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch, MagicMock
|
||||||
|
|
||||||
# Add the project root to Python path
|
# Add the project root to Python path
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../..'))
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../..'))
|
||||||
|
|
||||||
# Mock CUDA-dependent modules to avoid CI failures
|
# Mock nodes module to prevent CUDA initialization during import
|
||||||
with patch('comfy.model_management.get_torch_device', return_value=torch.device('cpu')):
|
mock_nodes = MagicMock()
|
||||||
with patch('comfy.model_management.get_total_memory', return_value=8192):
|
mock_nodes.MAX_RESOLUTION = 16384
|
||||||
from comfy_extras.nodes_images import ImageStitch
|
|
||||||
|
with patch.dict('sys.modules', {'nodes': mock_nodes}):
|
||||||
|
from comfy_extras.nodes_images import ImageStitch
|
||||||
|
|
||||||
|
|
||||||
class TestImageStitch:
|
class TestImageStitch:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user