diff --git a/app/main.py b/app/main.py index 955e9199..14e1a010 100644 --- a/app/main.py +++ b/app/main.py @@ -66,7 +66,9 @@ async def lifespan(app: FastAPI): config_issues = check_all_configs() # Log overall status - has_issues = any(config_issues['email']) or any(len(issues) > 0 for provider, issues in config_issues['storage'].items()) + has_issues = any(config_issues['email']) or any( + len(issues) > 0 for provider, issues in config_issues['storage'].items() + ) if has_issues: logging.warning("Application started with configuration issues - some features may be unavailable") else: diff --git a/test_startup.py b/test_startup.py deleted file mode 100644 index 8b5389d1..00000000 --- a/test_startup.py +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env python3 -""" -Simple test script to verify the application can start. -This script tests that the FastAPI app with lifespan can be created. -""" -import sys -import os - -# Set up minimal environment -os.environ.setdefault("DATABASE_URL", "sqlite:///:memory:") -os.environ.setdefault("REDIS_URL", "redis://localhost:6379/1") -os.environ.setdefault("OPENAI_API_KEY", "test-key") -os.environ.setdefault("AZURE_AI_KEY", "test-key") -os.environ.setdefault("AZURE_REGION", "test") -os.environ.setdefault("AZURE_ENDPOINT", "https://test.cognitiveservices.azure.com/") -os.environ.setdefault("GOTENBERG_URL", "http://localhost:3000") -os.environ.setdefault("WORKDIR", "/tmp") -os.environ.setdefault("AUTH_ENABLED", "False") -os.environ.setdefault("SESSION_SECRET", "test_secret_key_for_testing_must_be_at_least_32_characters_long") -os.environ.setdefault("EXTERNAL_HOSTNAME", "localhost") - -try: - # Import the app - this will fail if there are syntax errors or import issues - from app.main import app - print("✓ Successfully imported app.main") - - # Check that the app has the lifespan configured - if hasattr(app, 'router') and hasattr(app.router, 'lifespan_context'): - print("✓ App has lifespan context configured") - else: - print("✓ App created successfully (lifespan may not be directly testable)") - - # Check that there are no on_event handlers registered - # (In newer FastAPI versions, on_event is deprecated) - print("✓ App configuration looks correct") - - print("\n✅ All checks passed! The application should start correctly.") - sys.exit(0) - -except Exception as e: - print(f"\n❌ Error importing or configuring app: {e}") - import traceback - traceback.print_exc() - sys.exit(1)