File size: 604 Bytes
ea2ed3e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | #!/usr/bin/env python3
"""Run pytest with ComfyUI forced into CPU mode before test collection."""
from __future__ import annotations
import sys
import comfy.options
def main() -> int:
pytest_args = sys.argv[1:]
# comfy.cli_args parses the process argv lazily when the tested modules
# import model_management. Keep pytest's arguments out of that parser and
# make device discovery CPU-only.
sys.argv = [sys.argv[0], "--cpu"]
comfy.options.enable_args_parsing()
import pytest
return pytest.main(pytest_args)
if __name__ == "__main__":
raise SystemExit(main())
|