forked from tonycho/Awesome-Agentic-AI
55 lines
1.9 KiB
Python
55 lines
1.9 KiB
Python
import os
|
|
import subprocess
|
|
import sys
|
|
|
|
def run_tests():
|
|
test_dir = "tests"
|
|
scripts = [f for f in os.listdir(test_dir) if (f.startswith("verify_") or f.startswith("test_")) and f.endswith(".py")]
|
|
scripts.sort()
|
|
|
|
results = []
|
|
print(f"🚀 Starting Master Test Runner on {len(scripts)} scripts...")
|
|
print("-" * 50)
|
|
|
|
for script in scripts:
|
|
script_path = os.path.join(test_dir, script)
|
|
print(f"Running {script}...", end=" ", flush=True)
|
|
try:
|
|
# We use a timeout to prevent hanging tests
|
|
result = subprocess.run(
|
|
[sys.executable, script_path],
|
|
capture_output=True,
|
|
text=True,
|
|
timeout=30
|
|
)
|
|
if result.returncode == 0:
|
|
print("✅ PASSED")
|
|
results.append((script, "PASSED", ""))
|
|
else:
|
|
print("❌ FAILED")
|
|
results.append((script, "FAILED", result.stderr or result.stdout))
|
|
except subprocess.TimeoutExpired:
|
|
print("⏳ TIMEOUT")
|
|
results.append((script, "TIMEOUT", "Script took longer than 30 seconds"))
|
|
except Exception as e:
|
|
print("💥 ERROR")
|
|
results.append((script, "ERROR", str(e)))
|
|
|
|
print("-" * 50)
|
|
print("📊 Final Report:")
|
|
passed = sum(1 for r in results if r[1] == "PASSED")
|
|
failed = sum(1 for r in results if r[1] != "PASSED")
|
|
print(f"Total: {len(scripts)} | Passed: {passed} | Failed: {failed}")
|
|
|
|
if failed > 0:
|
|
print("\n❌ Failures Summary:")
|
|
for script, status, error in results:
|
|
if status != "PASSED":
|
|
print(f" - {script}: {status}")
|
|
# Print last few lines of error if available
|
|
if error:
|
|
print(f" Error: {error.strip().splitlines()[-1] if error.strip() else 'No specific error message'}")
|
|
|
|
if __name__ == "__main__":
|
|
run_tests()
|