We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 934ce06 commit 4961e4bCopy full SHA for 4961e4b
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
@@ -48,6 +46,10 @@
48
46
49
47
@asynccontextmanager
50
async def lifespan(_app: FastAPI):
+ # only run migrations when not under test
+ if "pytest" not in sys.modules:
51
+ run_migrations()
52
+
53
# Run before app bootstrap:
54
global _osm_client
55
_osm_client = httpx.AsyncClient(
0 commit comments