tts-api / test_build.py
Divax
test
94fd4b0
#!/usr/bin/env python3
"""
Simple build test for C-3PO TTS API
Tests if all dependencies can be imported
"""
def test_imports():
"""Test if all required packages can be imported"""
print("πŸ” Testing imports...")
try:
import fastapi
print("βœ… FastAPI")
import uvicorn
print("βœ… Uvicorn")
import torch
print("βœ… PyTorch")
import torchaudio
print("βœ… TorchAudio")
import TTS
print("βœ… Coqui TTS")
import huggingface_hub
print("βœ… Hugging Face Hub")
import pydantic
print("βœ… Pydantic")
return True
except ImportError as e:
print(f"❌ Import failed: {e}")
return False
def test_api_creation():
"""Test if the API can be created without errors"""
print("\nπŸš€ Testing API creation...")
try:
from coqui_api import app
print("βœ… API created successfully")
return True
except Exception as e:
print(f"❌ API creation failed: {e}")
return False
def main():
"""Run build tests"""
print("πŸ§ͺ C-3PO TTS Build Test")
print("=" * 30)
import_ok = test_imports()
api_ok = test_api_creation()
print("\n" + "=" * 30)
if import_ok and api_ok:
print("πŸŽ‰ All tests passed! Ready to deploy.")
return 0
else:
print("❌ Some tests failed. Check dependencies.")
return 1
if __name__ == "__main__":
exit(main())