mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-09-07 14:37:05 +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 sys
|
||||
import os
|
||||
from unittest.mock import patch
|
||||
from unittest.mock import patch, MagicMock
|
||||
|
||||
# Add the project root to Python path
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../..'))
|
||||
|
||||
# Mock CUDA-dependent modules to avoid CI failures
|
||||
with patch('comfy.model_management.get_torch_device', return_value=torch.device('cpu')):
|
||||
with patch('comfy.model_management.get_total_memory', return_value=8192):
|
||||
from comfy_extras.nodes_images import ImageStitch
|
||||
# Mock nodes module to prevent CUDA initialization during import
|
||||
mock_nodes = MagicMock()
|
||||
mock_nodes.MAX_RESOLUTION = 16384
|
||||
|
||||
with patch.dict('sys.modules', {'nodes': mock_nodes}):
|
||||
from comfy_extras.nodes_images import ImageStitch
|
||||
|
||||
|
||||
class TestImageStitch:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user