Skip to content

Commit ed39e8f

Browse files
committed
Gracefully skip DB-dependent Flask tests when postgres unavailable
1 parent ba0b8d1 commit ed39e8f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

app/tests/conftest.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,9 @@ def wait_for_database(dsn: str, timeout: float = 30.0) -> None:
9696
@pytest.fixture(scope="session", autouse=True)
9797
def _ensure_database_ready() -> None:
9898
dsn = resolve_dsn()
99-
wait_for_database(dsn)
99+
try:
100+
wait_for_database(dsn)
101+
except TimeoutError as exc:
102+
pytest.skip(f"Skipping DB-backed tests: {exc}")
103+
except RuntimeError as exc:
104+
pytest.skip(f"Skipping DB-backed tests due to runtime error: {exc}")

0 commit comments

Comments
 (0)