File size: 2,810 Bytes
24214fc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/usr/bin/env python3
"""
Test runner script for organized test structure.
"""

import subprocess
import sys
from pathlib import Path

def run_test_suite(test_path, description):
    """Run a specific test suite."""
    print(f"\n🧪 {description}")
    print("=" * 60)
    
    try:
        result = subprocess.run([
            sys.executable, '-m', 'pytest', 
            str(test_path), 
            '-v', '--tb=short'
        ], capture_output=True, text=True)
        
        if result.returncode == 0:
            print(f"✅ {description} - ALL PASSED")
            # Count passed tests
            lines = result.stdout.split('\n')
            for line in lines:
                if 'passed' in line and ('warning' in line or 'error' in line or line.strip().endswith('passed')):
                    print(f"   {line.strip()}")
                    break
        else:
            print(f"❌ {description} - SOME FAILED")
            print("STDOUT:", result.stdout[-500:])  # Last 500 chars
            print("STDERR:", result.stderr[-500:])  # Last 500 chars
        
        return result.returncode == 0
        
    except Exception as e:
        print(f"❌ Error running {description}: {e}")
        return False

def main():
    """Run all test suites."""
    print("🚀 Running Organized Test Suite")
    print("=" * 60)
    
    test_suites = [
        ('tests/prompt_optimization', 'Prompt Optimization Tests'),
        ('tests/integration', 'Integration Tests'),
        ('tests/unit', 'Unit Tests'),
        ('tests/verification_mode', 'Verification Mode Tests'),
        ('tests/chaplain_feedback', 'Chaplain Feedback Tests')
    ]
    
    results = []
    
    for test_path, description in test_suites:
        if Path(test_path).exists():
            success = run_test_suite(test_path, description)
            results.append((description, success))
        else:
            print(f"⚠️  Skipping {description} - directory not found")
            results.append((description, None))
    
    # Summary
    print("\n" + "=" * 60)
    print("📊 TEST SUMMARY")
    print("=" * 60)
    
    passed = 0
    failed = 0
    skipped = 0
    
    for description, success in results:
        if success is True:
            print(f"✅ {description}")
            passed += 1
        elif success is False:
            print(f"❌ {description}")
            failed += 1
        else:
            print(f"⚠️  {description} (skipped)")
            skipped += 1
    
    print(f"\n📈 Results: {passed} passed, {failed} failed, {skipped} skipped")
    
    if failed == 0:
        print("🎉 All test suites passed!")
        return 0
    else:
        print("⚠️  Some test suites failed. Check output above.")
        return 1

if __name__ == "__main__":
    sys.exit(main())