Skip to content

Commit bec80cf

Browse files
committed
GitHub Actions installs SQL dependencies for tests and database tests gracefully skip when SQLAlchemy isn't installed locally
1 parent 8cece02 commit bec80cf

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

.github/workflows/unit-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
5353
5454
- name: Install dependencies
55-
run: uv sync --dev
55+
run: uv sync --dev --extra sql
5656

5757
- name: Run tests
5858
run: uv run pytest

tests/server/tasks/test_database_task_store.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
import pytest_asyncio
77

88
from _pytest.mark.structures import ParameterSet
9+
10+
11+
# Skip entire test module if SQLAlchemy is not installed
12+
pytest.importorskip('sqlalchemy', reason='Database tests require SQLAlchemy')
13+
14+
# Now safe to import SQLAlchemy-dependent modules
915
from sqlalchemy.ext.asyncio import create_async_engine
1016
from sqlalchemy.inspection import inspect
1117

0 commit comments

Comments
 (0)