Open-Source Wikis

/

ComfyUI

/

How to contribute

/

Testing

comfyanonymous/ComfyUI

Testing

ComfyUI has two test trees with different responsibilities. They are run separately in CI.

tests-unit/ — pytest unit tests

Pure-Python tests that don't need a running server or a GPU. They live in tests-unit/ and have their own requirements.txt.

pip install -r tests-unit/requirements.txt
pytest tests-unit

Subdirectories cover specific subsystems:

Path What it covers
tests-unit/app_test/ App-level managers (frontend, model, custom nodes, users)
tests-unit/assets_test/ The asset DB, scanner, ingest, schemas
tests-unit/comfy_api_test/ The public comfy_api surface
tests-unit/comfy_extras_test/ Selected comfy_extras/ node implementations
tests-unit/comfy_quant/ Quantization (comfy/quant_ops.py, MixedPrecisionOps)
tests-unit/comfy_test/ comfy/ core (model management, helpers)
tests-unit/execution_test/ The prompt executor and execution graph
tests-unit/folder_paths_test/ folder_paths.py
tests-unit/server_test/ server.py helpers and middleware
tests-unit/seeder_test/ Asset background seeder
tests-unit/prompt_server_test/ PromptServer behavior in isolation
tests-unit/feature_flags_test.py Frontend/backend feature flags
tests-unit/websocket_feature_flags_test.py Feature-flag negotiation over WebSocket

The CI pipeline that runs these is .github/workflows/test-unit.yml.

tests/ — integration tests

End-to-end tests that hit a running ComfyUI server with real (or mocked) workflows. They live in tests/ and have a conftest.py that boots the test environment.

pytest tests

Subdirectories:

Path What it covers
tests/inference/ Reference inference workflows
tests/execution/ The prompt executor end-to-end (the canonical execution-engine regression)
tests/compare/ Compares outputs against reference results
tests/test_asset_seeder.py Asset seeder integration

The corresponding CI workflow is .github/workflows/test-execution.yml. A separate launch-smoke workflow (test-launch.yml) ensures python main.py --quick-test-for-ci exits cleanly on a fresh install.

Pytest configuration

pytest.ini at the repo root configures discovery for both trees.

Adding tests

For a new built-in node, the convention is to add a corresponding test under tests-unit/comfy_extras_test/. For changes to the executor, add an execution_test/ case mirroring the closest existing one. Tests should not require GPU unless they explicitly skip on cuda unavailability.

Manual sanity

For changes that touch model loading, sampling, or memory management, also run a real workflow once:

  1. python main.py.
  2. Load a small workflow (e.g., SD1.5 t2i).
  3. Queue and confirm the output looks normal.

This catches things like dtype regressions and wrong-device tensors that unit tests don't see.

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

Testing – ComfyUI wiki | Factory