We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 934ce06 commit 7fd871cCopy full SHA for 7fd871c
1 file changed
api/main.py
@@ -1,5 +1,6 @@
1
import os
2
import re
3
+import sys
4
from contextlib import asynccontextmanager
5
6
import httpx
@@ -36,9 +37,6 @@
36
37
# Set up logging configuration
38
setup_logging()
39
-# Optional: Run migrations on startup
40
-run_migrations()
41
-
42
# Set up logger for this module
43
logger = get_logger(__name__)
44
@@ -57,6 +55,10 @@ async def lifespan(_app: FastAPI):
57
55
)
58
56
init_tdei_client()
59
+ # only run migrations when not under test
+ if "pytest" not in sys.modules:
60
+ run_migrations()
61
+
62
yield # App runs
63
64
# Run after app cleanup:
0 commit comments