#!/usr/bin/env python3 """ Run tests for Local Deep Research. This script runs pytest with appropriate configuration for the project. Referenced in CONTRIBUTING.md — do not delete without updating that file. """ import os import subprocess import sys from pathlib import Path def main(): """Run the test suite with appropriate settings.""" # Get the project root directory project_root = Path(__file__).parent.absolute() # Ensure PYTHONPATH includes the project root for proper imports os.environ["PYTHONPATH"] = str(project_root) # Configure pytest arguments pytest_args = [ sys.executable, # Use Python interpreter "-m", # Run module "pytest", # Call pytest "--verbose", # Verbose output "--color=yes", # Force colored output "--cov=src", # Measure coverage for src directory "--cov-report=term", # Report coverage in terminal "--cov-report=html:coverage_html", # Also generate HTML report "--cov-config=.coveragerc", # Use the coverage configuration file ] # Add any command line arguments passed to this script pytest_args.extend(sys.argv[1:]) # Print the command being run print(f"Running: {' '.join(pytest_args)}") # Run pytest and capture the return code result = subprocess.run(pytest_args) # Return the pytest exit code return result.returncode if __name__ == "__main__": sys.exit(main())