From 9ab7f2fe210593a93d86e0755ad7068dd80a5e3e Mon Sep 17 00:00:00 2001 From: William Bergamin Date: Fri, 25 Sep 2026 10:50:50 -0400 Subject: [PATCH] ci: use psycopg 3 for the PostgreSQL database tests SQLAlchemy 2.1.0 (released 2026-09-24) changed the default driver for bare postgresql:// URLs from psycopg2 to psycopg (v3). The Database Unit Tests job used a bare URL but only installed psycopg2-binary, so create_engine failed with "No module named 'psycopg'" on every run: https://github.com/slackapi/python-slack-sdk/actions/runs/36079341012 Install psycopg[binary] in place of psycopg2-binary and name the driver explicitly in TEST_DATABASE_URL, the form SQLAlchemy's 2.1 migration guide recommends, so the job no longer depends on SQLAlchemy's default. Co-Authored-By: Claude --- .github/workflows/ci-build.yml | 2 +- requirements/databases.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index ec479ef4c..91ee9b133 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -152,7 +152,7 @@ jobs: pip install -r requirements/databases.txt - name: Run sync tests (PostgreSQL) env: - TEST_DATABASE_URL: postgresql://test_user:password@localhost/test + TEST_DATABASE_URL: postgresql+psycopg://test_user:password@localhost/test run: | PYTHONPATH=$PWD:$PYTHONPATH pytest -s tests/slack_sdk/oauth/installation_store/test_sqlalchemy.py PYTHONPATH=$PWD:$PYTHONPATH pytest -s tests/slack_sdk/oauth/state_store/test_sqlalchemy.py diff --git a/requirements/databases.txt b/requirements/databases.txt index dc18e6c3b..bdb5c457d 100644 --- a/requirements/databases.txt +++ b/requirements/databases.txt @@ -1,9 +1,9 @@ # pip install -r requirements/databases.txt # Database drivers for CI testing. -# psycopg2-binary +# psycopg # Note: postgreSQL driver (sync). -psycopg2-binary>=2.9.12,<3 +psycopg[binary]>=3.3.6,<4 # asyncpg # Note: postgreSQL driver (async).