summary refs log tree commit diff
diff options
context:
space:
mode:
-rwxr-xr-x.ci/scripts/calculate_jobs.py31
-rw-r--r--.github/workflows/tests.yml4
-rw-r--r--synapse/storage/engines/__init__.py1
-rw-r--r--synapse/storage/engines/psycopg.py1
-rw-r--r--synapse/storage/engines/psycopg2.py1
5 files changed, 26 insertions, 12 deletions
diff --git a/.ci/scripts/calculate_jobs.py b/.ci/scripts/calculate_jobs.py
index ab1d214727..dfa32a5445 100755
--- a/.ci/scripts/calculate_jobs.py
+++ b/.ci/scripts/calculate_jobs.py
@@ -50,23 +50,38 @@ if not IS_PR:
         for version in ("3.9", "3.10", "3.11", "3.12")
     )
 
+# Run with both psycopg2 and psycopg.
 trial_postgres_tests = [
     {
         "python-version": "3.8",
         "database": "postgres",
         "postgres-version": "11",
         "extras": "all",
-    }
+    },
+    {
+        "python-version": "3.8",
+        "database": "psycopg",
+        "postgres-version": "11",
+        "extras": "all",
+    },
 ]
 
 if not IS_PR:
-    trial_postgres_tests.append(
-        {
-            "python-version": "3.12",
-            "database": "postgres",
-            "postgres-version": "16",
-            "extras": "all",
-        }
+    trial_postgres_tests.extend(
+        [
+            {
+                "python-version": "3.12",
+                "database": "postgres",
+                "postgres-version": "16",
+                "extras": "all",
+            },
+            {
+                "python-version": "3.12",
+                "database": "psycopg",
+                "postgres-version": "16",
+                "extras": "all",
+            },
+        ]
     )
 
 trial_no_extra_tests = [
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index a1f714da23..af32cb604e 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -346,7 +346,9 @@ jobs:
         run: until pg_isready -h localhost; do sleep 1; done
       - run: poetry run trial --jobs=6 tests
         env:
-          SYNAPSE_POSTGRES: ${{ matrix.job.database == 'postgres' || '' }}
+          # If matrix.job.database is 'psycopg' set SYNAPSE_POSTGRES to that string;
+          # otherwise if it is 'postgres' set it to true. Otherwise, empty.
+          SYNAPSE_POSTGRES: ${{ matrix.job.database == 'psycopg' && 'psycopg' || matrix.job.database == 'postgres' || '' }}
           SYNAPSE_POSTGRES_HOST: /var/run/postgresql
           SYNAPSE_POSTGRES_USER: postgres
           SYNAPSE_POSTGRES_PASSWORD: postgres
diff --git a/synapse/storage/engines/__init__.py b/synapse/storage/engines/__init__.py
index 7ce3d9fc25..d3edf0db9d 100644
--- a/synapse/storage/engines/__init__.py
+++ b/synapse/storage/engines/__init__.py
@@ -16,7 +16,6 @@ from typing import Any, Mapping, NoReturn
 from ._base import BaseDatabaseEngine, IncorrectDatabaseSetup
 from .postgres import PostgresEngine
 
-
 # The classes `PostgresEngine` and `Sqlite3Engine` must always be importable, because
 # we use `isinstance(engine, PostgresEngine)` to write different queries for postgres
 # and sqlite. But the database driver modules are both optional: they may not be
diff --git a/synapse/storage/engines/psycopg.py b/synapse/storage/engines/psycopg.py
index ce2dea5933..8d054ab6df 100644
--- a/synapse/storage/engines/psycopg.py
+++ b/synapse/storage/engines/psycopg.py
@@ -24,7 +24,6 @@ from twisted.enterprise.adbapi import Connection as TxConnection
 from synapse.storage.engines import PostgresEngine
 from synapse.storage.engines._base import IsolationLevel
 
-
 logger = logging.getLogger(__name__)
 
 
diff --git a/synapse/storage/engines/psycopg2.py b/synapse/storage/engines/psycopg2.py
index 817ad6d568..e8af8c2c48 100644
--- a/synapse/storage/engines/psycopg2.py
+++ b/synapse/storage/engines/psycopg2.py
@@ -20,7 +20,6 @@ import psycopg2.extensions
 from synapse.storage.engines import PostgresEngine
 from synapse.storage.engines._base import IsolationLevel
 
-
 logger = logging.getLogger(__name__)