#!/usr/bin/env python3
"""
Simple MCP Test Runner - Windows Compatible
"""
import os
import sys
import subprocess
import time
from pathlib import Path
# Add parent directory to path
sys.path.insert(0, str(Path(__file__).parent.parent))
def run_test(test_path):
"""Run a single test file"""
print(f"\n{'='*50}")
print(f"Running: {test_path.name}")
print(f"{'='*50}")
start_time = time.time()
try:
result = subprocess.run(
[sys.executable, str(test_path)],
cwd=test_path.parent.parent,
capture_output=True,
text=True,
timeout=120
)
execution_time = time.time() - start_time
if result.returncode == 0:
print(f"[PASS] Completed in {execution_time:.2f}s")
return True
else:
print(f"[FAIL] Failed in {execution_time:.2f}s")
if result.stderr:
print("Error:", result.stderr[:200])
return False
except Exception as e:
print(f"[ERROR] {e}")
return False
def main():
test_dir = Path(__file__).parent
print("MCP Test Runner - Quick Health Check")
print("="*50)
# Priority tests
priority_tests = [
'api/test_all_endpoints_simple.py',
'core/test_core_smart_search.py'
]
results = []
for test_path in priority_tests:
full_path = test_dir / test_path
if full_path.exists():
success = run_test(full_path)
results.append((test_path, success))
else:
print(f"[WARN] Test not found: {test_path}")
results.append((test_path, False))
# Summary
print(f"\nTest Summary")
print("="*50)
total = len(results)
passed = sum(1 for _, success in results if success)
print(f"Total: {total}")
print(f"Passed: {passed}")
print(f"Failed: {total - passed}")
print(f"Success Rate: {(passed/total*100):.1f}%")
if passed == total:
print("\n[OK] All priority tests passed!")
else:
print(f"\n[WARN] {total - passed} tests failed")
if __name__ == "__main__":
main()