Spaces:
Sleeping
Sleeping
File size: 2,069 Bytes
7644eac | 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 | """
Test script to verify all imports work correctly
Run this before deploying to catch any import errors
"""
import sys
from pathlib import Path
# Add project root to path
PROJECT_ROOT = Path(__file__).parent
sys.path.insert(0, str(PROJECT_ROOT))
print("=" * 60)
print("Testing Imports for Hybrid Architecture")
print("=" * 60)
errors = []
# Test backend imports
print("\nπ¦ Testing Backend Imports...")
try:
from backend import app
print("β
backend.app")
except Exception as e:
print(f"β backend.app: {e}")
errors.append(("backend.app", e))
try:
from backend import routes
print("β
backend.routes")
except Exception as e:
print(f"β backend.routes: {e}")
errors.append(("backend.routes", e))
# Test worker imports
print("\nβοΈ Testing Worker Imports...")
try:
from worker import celery_app
print("β
worker.celery_app")
except Exception as e:
print(f"β worker.celery_app: {e}")
errors.append(("worker.celery_app", e))
try:
from worker import tasks
print("β
worker.tasks")
except Exception as e:
print(f"β worker.tasks: {e}")
errors.append(("worker.tasks", e))
# Test existing src imports
print("\nπ§ Testing Existing Src Imports...")
try:
from src.learning_path import LearningPathGenerator
print("β
src.learning_path.LearningPathGenerator")
except Exception as e:
print(f"β src.learning_path.LearningPathGenerator: {e}")
errors.append(("src.learning_path", e))
try:
from src.ml.model_orchestrator import ModelOrchestrator
print("β
src.ml.model_orchestrator.ModelOrchestrator")
except Exception as e:
print(f"β src.ml.model_orchestrator: {e}")
errors.append(("src.ml.model_orchestrator", e))
# Summary
print("\n" + "=" * 60)
if not errors:
print("π All imports successful!")
print("\nβ
Ready for deployment!")
else:
print(f"β οΈ {len(errors)} import error(s) found:")
for module, error in errors:
print(f" - {module}: {error}")
print("\nβ Fix these errors before deploying")
print("=" * 60)
|