Fix line length to comply with Black formatting (120 chars)
- Break long line in lifespan function to multiple lines - Remove test_startup.py (not needed, existing tests validate startup) Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
+3
-1
@@ -66,7 +66,9 @@ async def lifespan(app: FastAPI):
|
|||||||
config_issues = check_all_configs()
|
config_issues = check_all_configs()
|
||||||
|
|
||||||
# Log overall status
|
# 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:
|
if has_issues:
|
||||||
logging.warning("Application started with configuration issues - some features may be unavailable")
|
logging.warning("Application started with configuration issues - some features may be unavailable")
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -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)
|
|
||||||
Reference in New Issue
Block a user