mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-22 13:42:12 -03:00
47 lines
1.2 KiB
Python
47 lines
1.2 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Test runner script for ComfyUI-Lora-Manager.
|
|
|
|
This script runs pytest from the tests directory to avoid import issues
|
|
with the root __init__.py file.
|
|
"""
|
|
import subprocess
|
|
import sys
|
|
import os
|
|
from pathlib import Path
|
|
|
|
def main():
|
|
"""Run pytest from the tests directory to avoid import issues."""
|
|
# Get the script directory
|
|
script_dir = Path(__file__).parent.absolute()
|
|
tests_dir = script_dir / "tests"
|
|
|
|
if not tests_dir.exists():
|
|
print(f"Error: Tests directory not found at {tests_dir}")
|
|
return 1
|
|
|
|
# Change to tests directory
|
|
original_cwd = os.getcwd()
|
|
os.chdir(tests_dir)
|
|
|
|
try:
|
|
# Build pytest command
|
|
cmd = [
|
|
sys.executable, "-m", "pytest",
|
|
"-v",
|
|
"--rootdir=.",
|
|
] + sys.argv[1:] # Pass any additional arguments
|
|
|
|
print(f"Running: {' '.join(cmd)}")
|
|
print(f"Working directory: {tests_dir}")
|
|
|
|
# Run pytest
|
|
result = subprocess.run(cmd, cwd=tests_dir)
|
|
return result.returncode
|
|
finally:
|
|
# Restore original working directory
|
|
os.chdir(original_cwd)
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|