File size: 1,115 Bytes
4f67c26 |
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 |
#!/usr/bin/env python3
"""
Test script to verify the FastAPI app can be imported and started
"""
import sys
import os
# Add current directory to path
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
try:
# Test imports
print("Testing imports...")
from backend_service import app
print("β
Successfully imported FastAPI app from backend_service")
# Test app type
from fastapi import FastAPI
if isinstance(app, FastAPI):
print("β
App is a valid FastAPI instance")
else:
print("β App is not a FastAPI instance")
sys.exit(1)
# Test app attributes
print(f"β
App title: {app.title}")
print(f"β
App version: {app.version}")
print("\nπ All tests passed! The app is ready for Hugging Face Spaces")
except ImportError as e:
print(f"β Import error: {e}")
print("This is expected if you don't have all dependencies installed locally.")
print("The Hugging Face Space will install them from requirements.txt")
except Exception as e:
print(f"β Unexpected error: {e}")
sys.exit(1)
|