#!/usr/bin/env python3 """ Test runner script for NL→SQL Leaderboard """ import os import sys import subprocess from pathlib import Path def run_tests(): """Run all tests with proper configuration.""" # Set test environment os.environ["MOCK_MODE"] = "true" os.environ["HF_TOKEN"] = "" # Ensure no real API calls # Change to project root project_root = Path(__file__).parent os.chdir(project_root) # Run pytest cmd = [ sys.executable, "-m", "pytest", "test/", "-v", "--tb=short", "--cov=src", "--cov-report=term-missing", "--cov-report=html:htmlcov" ] print("🧪 Running NL→SQL Leaderboard Tests") print("=" * 50) try: result = subprocess.run(cmd, check=True) print("\n✅ All tests passed!") return result.returncode except subprocess.CalledProcessError as e: print(f"\n❌ Tests failed with exit code {e.returncode}") return e.returncode except Exception as e: print(f"\n❌ Error running tests: {e}") return 1 if __name__ == "__main__": exit_code = run_tests() sys.exit(exit_code)