File size: 3,162 Bytes
5e3b5d8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
05d082e
5e3b5d8
05d082e
5e3b5d8
 
 
 
 
 
05d082e
5e3b5d8
05d082e
5e3b5d8
 
 
 
05d082e
5e3b5d8
05d082e
5e3b5d8
 
 
 
05d082e
5e3b5d8
05d082e
5e3b5d8
 
 
 
 
 
 
 
 
 
05d082e
5e3b5d8
 
 
05d082e
5e3b5d8
 
 
05d082e
5e3b5d8
 
 
 
05d082e
5e3b5d8
 
 
 
 
 
05d082e
5e3b5d8
 
 
 
 
 
 
 
 
 
 
 
 
05d082e
5e3b5d8
 
 
 
 
 
 
 
05d082e
5e3b5d8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
05d082e
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/usr/bin/env python3
"""
Simple build test to check if the application can import and start
"""

def test_imports():
    """Test if all required imports work"""
    print("🧪 Testing imports...")
    
    try:
        import os
        import torch
        import tempfile
        import gradio as gr
        from fastapi import FastAPI, HTTPException
        print("SUCCESS: Basic imports successful")
    except ImportError as e:
        print(f"ERROR: Basic import failed: {e}")
        return False
    
    try:
        import logging
        import asyncio
        from typing import Optional
        print("SUCCESS: Standard library imports successful")
    except ImportError as e:
        print(f"ERROR: Standard library import failed: {e}")
        return False
    
    try:
        from robust_tts_client import RobustTTSClient
        print("SUCCESS: Robust TTS client import successful")
    except ImportError as e:
        print(f"ERROR: Robust TTS client import failed: {e}")
        return False
    
    try:
        from advanced_tts_client import AdvancedTTSClient
        print("SUCCESS: Advanced TTS client import successful")
    except ImportError as e:
        print(f"WARNING: Advanced TTS client import failed (this is OK): {e}")
    
    return True

def test_app_creation():
    """Test if the app can be created"""
    print("\n🏗️ Testing app creation...")
    
    try:
        # Import the main app components
        from app import app, omni_api, TTSManager
        print("SUCCESS: App components imported successfully")
        
        # Test TTS manager creation
        tts_manager = TTSManager()
        print("SUCCESS: TTS manager created successfully")
        
        # Test app instance
        if app:
            print("SUCCESS: FastAPI app created successfully")
        
        return True
        
    except Exception as e:
        print(f"ERROR: App creation failed: {e}")
        import traceback
        traceback.print_exc()
        return False

def main():
    """Run all tests"""
    print("[LAUNCH] BUILD TEST SUITE")
    print("=" * 50)
    
    tests = [
        ("Import Test", test_imports),
        ("App Creation Test", test_app_creation)
    ]
    
    results = []
    for name, test_func in tests:
        try:
            result = test_func()
            results.append((name, result))
        except Exception as e:
            print(f"ERROR: {name} crashed: {e}")
            results.append((name, False))
    
    # Summary
    print("\n" + "=" * 50)
    print("TEST RESULTS")
    print("=" * 50)
    
    for name, result in results:
        status = "SUCCESS: PASS" if result else "ERROR: FAIL"
        print(f"{name}: {status}")
    
    passed = sum(1 for _, result in results if result)
    total = len(results)
    
    print(f"\nOverall: {passed}/{total} tests passed")
    
    if passed == total:
        print("🎉 BUILD SUCCESSFUL! The application should start correctly.")
        return True
    else:
        print("💥 BUILD FAILED! Check the errors above.")
        return False

if __name__ == "__main__":
    success = main()
    exit(0 if success else 1)