39 lines
1.8 KiB
INI
39 lines
1.8 KiB
INI
# ═══════════════════════════════════════════════════════════════════════════
|
|
# Pytest Configuration for ComfyUI-Doctor
|
|
# ═══════════════════════════════════════════════════════════════════════════
|
|
# Purpose: Prevent pytest from importing __init__.py as a test module
|
|
#
|
|
# Problem (without this config):
|
|
# - pytest auto-discovers all Python files
|
|
# - Tries to import __init__.py as a test module
|
|
# - __init__.py uses relative imports (from .logger import ...)
|
|
# - Relative imports fail with "no known parent package" error
|
|
#
|
|
# Solution:
|
|
# - Explicitly tell pytest to only look in tests/ directory
|
|
# - Ignore __init__.py and other non-test files
|
|
#
|
|
# Last Modified: 2026-01-03 (Fixed CI import errors)
|
|
# ═══════════════════════════════════════════════════════════════════════════
|
|
[pytest]
|
|
# Only collect tests from these directories
|
|
testpaths = tests
|
|
|
|
# Ignore these files during test collection
|
|
norecursedirs = .git .github REFERENCE web patterns __pycache__ *.egg-info
|
|
|
|
# Don't try to import __init__.py as a test module
|
|
python_files = test_*.py
|
|
python_classes = Test*
|
|
python_functions = test_*
|
|
|
|
# CRITICAL: Use importlib mode to prevent pytest from treating root as package
|
|
# This prevents pytest from trying to import the root __init__.py
|
|
addopts = --import-mode=importlib
|
|
|
|
[tool:pytest]
|
|
asyncio_mode = auto
|
|
asyncio_default_fixture_loop_scope = function
|
|
markers =
|
|
asyncio: mark test as asyncio based
|