Files
comfyui_o1key/tests/run_all.py
T
Jony ba920f2b66 Publish current ComfyUI O1Key code baseline
Replace the prior release tree with the current plugin, frontend, tests, and documentation. Document retired node IDs and the public Gitea update source.
2026-09-24 19:56:48 +08:00

51 lines
1.2 KiB
Python

"""Run each test file in an isolated process.
Several tests install lightweight ComfyUI stubs in ``sys.modules``. Running
every file in one unittest discovery process lets those stubs leak between
modules, so isolation is intentional here.
"""
from __future__ import annotations
import shutil
import subprocess
import sys
from pathlib import Path
TEST_DIR = Path(__file__).resolve().parent
def main() -> int:
commands = [
[sys.executable, str(path)]
for path in sorted(TEST_DIR.glob("test_*.py"))
]
node = shutil.which("node")
if node:
commands.extend(
[node, str(path)]
for path in sorted(TEST_DIR.glob("test_*.mjs"))
)
failures = []
for command in commands:
print(f"\n>>> {' '.join(command)}", flush=True)
completed = subprocess.run(command, cwd=TEST_DIR.parent, check=False)
if completed.returncode:
failures.append((command[-1], completed.returncode))
if failures:
print("\nFailed tests:")
for path, returncode in failures:
print(f"- {path}: exit {returncode}")
return 1
print(f"\nAll {len(commands)} isolated test files passed.")
return 0
if __name__ == "__main__":
raise SystemExit(main())