-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_server_quick.py
More file actions
55 lines (47 loc) · 1.53 KB
/
test_server_quick.py
File metadata and controls
55 lines (47 loc) · 1.53 KB
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
import subprocess
import sys
import time
import signal
import threading
from main import app
def test_server_startup():
"""Test that the server can start without crashing"""
print("Testing server startup...")
# Import test to ensure no syntax errors
try:
from main import app
print("✅ main.py imports successfully")
except Exception as e:
print(f"❌ Import error: {e}")
return False
# Test that we can create the app instance
try:
assert app is not None
print("✅ FastAPI app instance created")
except Exception as e:
print(f"❌ App creation error: {e}")
return False
# Test routes are available
try:
routes = [route.path for route in app.routes]
expected_routes = ["/", "/health", "/upload-csv/", "/database/all-data"]
for route in expected_routes:
if route not in routes:
print(f"❌ Route {route} missing")
return False
print("✅ All expected routes are available")
return True
except Exception as e:
print(f"❌ Route checking error: {e}")
return False
if __name__ == "__main__":
print("🧪 Quick server startup test")
print("=" * 40)
if test_server_startup():
print("=" * 40)
print("🎉 Server startup test PASSED!")
print("The main.py application is ready to run.")
else:
print("=" * 40)
print("❌ Server startup test FAILED!")
sys.exit(1)