Additional attempt to make GitHub automatic tests work

This commit is contained in:
StableLlama
2025-05-25 15:11:12 +02:00
parent 48c68f3e5c
commit 09c7b41830
3 changed files with 40 additions and 38 deletions
+1
View File
@@ -35,3 +35,4 @@ jobs:
- name: Run Tests
run: |
pytest tests/
working-directory: ./
+3 -2
View File
@@ -46,14 +46,15 @@ Icon = ""
minversion = "8.0"
pythonpath = [
"src",
"../..", # Path to parent directory containing comfy module
#"../..", # Path to parent directory containing comfy module
"."
]
testpaths = [
"tests",
]
#python_files = ["test_*.py"]
python_files = ["conftest.py", "test_boolean_nodes.py"]
#python_files = ["conftest.py", "test_boolean_nodes.py"]
python_files = ["test_boolean_nodes.py"]
[tool.mypy]
files = "."
+36 -36
View File
@@ -1,36 +1,36 @@
import os
import sys
from unittest.mock import MagicMock
# Add the project root directory to Python path
# This allows the tests to import the project
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
print("=======================================================================")
print("Mocking 'comfy.comfy_types.node_typing' via conftest.py")
print("=======================================================================")
# Create a dummy 'comfy.comfy_types.node_typing' module
mock_comfy = MagicMock()
mock_comfy.IO = MagicMock(
BOOLEAN="BOOLEAN",
INT="INT",
FLOAT="FLOAT",
STRING="STRING",
NUMBER = "FLOAT,INT",
ANY="*",
)
mock_comfy.ComfyNodeABC = object
# Inject the mocked module into sys.modules
sys.modules["comfy"] = mock_comfy
sys.modules["comfy.comfy_types"] = mock_comfy
sys.modules["comfy.comfy_types.node_typing"] = mock_comfy
def mock_execution_blocker(_):
return None
mock_comfy_execution = MagicMock()
mock_comfy_execution.ExecutionBlocker = mock_execution_blocker
sys.modules["comfy_execution"] = mock_comfy_execution
sys.modules["comfy_execution.graph"] = mock_comfy_execution
# import os
# import sys
# from unittest.mock import MagicMock
#
# # Add the project root directory to Python path
# # This allows the tests to import the project
# sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
#
# print("=======================================================================")
# print("Mocking 'comfy.comfy_types.node_typing' via conftest.py")
# print("=======================================================================")
#
# # Create a dummy 'comfy.comfy_types.node_typing' module
# mock_comfy = MagicMock()
# mock_comfy.IO = MagicMock(
# BOOLEAN="BOOLEAN",
# INT="INT",
# FLOAT="FLOAT",
# STRING="STRING",
# NUMBER = "FLOAT,INT",
# ANY="*",
# )
# mock_comfy.ComfyNodeABC = object
#
# # Inject the mocked module into sys.modules
# sys.modules["comfy"] = mock_comfy
# sys.modules["comfy.comfy_types"] = mock_comfy
# sys.modules["comfy.comfy_types.node_typing"] = mock_comfy
#
# def mock_execution_blocker(_):
# return None
#
# mock_comfy_execution = MagicMock()
# mock_comfy_execution.ExecutionBlocker = mock_execution_blocker
# sys.modules["comfy_execution"] = mock_comfy_execution
# sys.modules["comfy_execution.graph"] = mock_comfy_execution