#!/usr/bin/env python3 """ Test runner script for TheChart application. Run this script to execute all tests with coverage reporting. """ import os import subprocess import sys def run_tests(): """Run all tests with coverage reporting.""" # Change to project root directory project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) os.chdir(project_root) print("Running TheChart tests with coverage...") print(f"Project root: {project_root}") # Run pytest with coverage cmd = [ sys.executable, "-m", "pytest", "tests/", "--verbose", "--cov=src", "--cov-report=term-missing", "--cov-report=html:htmlcov", "--cov-report=xml", ] try: result = subprocess.run(cmd, check=False) 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)