legal-doc-masker/backend/run_tests.py

33 lines
816 B
Python

#!/usr/bin/env python3
"""
Simple test runner script to verify test discovery and execution
"""
import subprocess
import sys
import os
from pathlib import Path
def run_tests():
"""Run pytest with proper configuration"""
# Change to backend directory
backend_dir = Path(__file__).parent
os.chdir(backend_dir)
# Run pytest
cmd = [sys.executable, "-m", "pytest", "tests/", "-v", "--tb=short"]
print(f"Running tests from: {backend_dir}")
print(f"Command: {' '.join(cmd)}")
print("-" * 50)
try:
result = subprocess.run(cmd, capture_output=False, text=True)
return result.returncode
except Exception as e:
print(f"Error running tests: {e}")
return 1
if __name__ == "__main__":
exit_code = run_tests()
sys.exit(exit_code)