(AI) attempt fixing tests

This commit is contained in:
mcDandy
2026-01-08 15:15:54 +01:00
parent 6df71eea84
commit b970d0db47
3 changed files with 22 additions and 7 deletions
+8
View File
@@ -63,11 +63,19 @@ jobs:
pip install .[dev]
pip install -r requirements.txt
- name: Clone ComfyUI dependency
run: |
git clone --depth 1 https://github.com/comfyanonymous/ComfyUI.git ../ComfyUI-repo
cp -r ../ComfyUI-repo/comfy ../
cp -r ../ComfyUI-repo/comfy_api ../
- name: Run Linting
run: |
ruff check .
- name: Run Tests
env:
PYTHONPATH: .
run: |
pytest tests/
+14 -3
View File
@@ -15,10 +15,21 @@ for p in [_project_root, _comfy_root]:
# Special case: 'more_math' root folder has an __init__.py which conflicts with the 'more_math' subfolder.
# We want 'import more_math' to resolve to the subfolder package.
if "more_math" not in sys.modules or "custom_nodes" in (getattr(sys.modules["more_math"], "__file__", "") or ""):
_subfolder = os.path.join(_project_root, "more_math")
_sub_init = os.path.join(_subfolder, "__init__.py")
# Check if we are accidentally importing the root folder as the package
def _is_root_package():
if "more_math" not in sys.modules:
return False
m = sys.modules["more_math"]
m_file = getattr(m, "__file__", "") or ""
# If the module file is NOT in the subfolder, it's likely the root folder's __init__.py
return os.path.abspath(m_file) != os.path.abspath(_sub_init)
if _is_root_package() or "more_math" not in sys.modules:
import importlib.util
_subfolder = os.path.join(_project_root, "more_math")
_spec = importlib.util.spec_from_file_location("more_math", os.path.join(_subfolder, "__init__.py"))
_spec = importlib.util.spec_from_file_location("more_math", _sub_init)
if _spec:
_m = importlib.util.module_from_spec(_spec)
sys.modules["more_math"] = _m
-4
View File
@@ -1,4 +0,0 @@
[pytest]
testpaths = . # Run tests in the current directory
python_files = test_*.py # Run tests in files that start with "test_"
norecursedirs = .. # Don't run tests in the parent directory