Files
AEmotionStudio-ComfyUI-Shad…/tests/conftest.py
T
Æmotion StudioandClaude Opus 5 141225b357 test: add pytest scaffold, generator smoke tests and legacy goldens
Runs inside ComfyUI's venv without a server, loading the pack (its folder
name has hyphens) as the importable package `snk`:

    ~/ComfyUI/venv/bin/python -m pytest custom_nodes/comfyui-shadernoiseksampler/tests

- helpers.py: package loader, a FakeModel carrying ComfyUI's real
  model_sampling/latent_format objects, and a recording fake for
  comfy.sample.sample.
- test_generators_smoke.py: every generator must return [B, C, H, W] and
  finite values across octaves, channels, masks and colour schemes. This
  is what caught the tensor_field crash.
- golden_cases.py / capture_golden.py / test_legacy_golden.py: 11 recorded
  configurations pinning exactly what the pre-2.0 pipeline sends to the
  sampler, so the upcoming refactor cannot change legacy behaviour.

pytest.ini lives in tests/ so this directory is the rootdir; otherwise
pytest imports the pack's __init__.py as a test package and fails on its
relative imports.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-11 15:03:28 -07:00

10 lines
316 B
Python

"""Put the tests directory on sys.path so test modules can import the shared helpers."""
import os
import sys
TESTS_DIR = os.path.dirname(os.path.abspath(__file__))
if TESTS_DIR not in sys.path:
sys.path.insert(0, TESTS_DIR)
import helpers # noqa: E402,F401 (loads ComfyUI + the pack before any test module)