]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commitdiff
force the driver level on the bulk insert PG tests
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 16 Dec 2025 03:01:06 +0000 (22:01 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 16 Dec 2025 03:36:50 +0000 (22:36 -0500)
this changes to use the psycopg2 dialect in all cases
even if the default for postgresql changes.

this is to prepare for SQLAlchemy moving to psycopg as the
default dialect. I had hoped to move these tests to use psycopg
and test for bind casts, however, we are still running tests against
SQLAlchemy 1.4 which does not have the psycopg dialect.   so stick with
psycopg2 for now.

also adds an rmtree for build/ as apparently pip install is re-using
this directory if it's there from a previous build, and the
artfacts left over from the gerrit for "plugins" is interfering with
the stubs generation.   We really should find a way to make the stub
generation / testing more robust as it breaks much too easily and
without an easy way to tell why.

Change-Id: Ibdab43a2cda5ec4f697d35c8a5f090aa56492703

noxfile.py
setup.cfg
tests/test_bulk_insert.py

index 2752e8b5fbdaca210ba96491713fbbd667e383fe..6a47050371d4b0a1d8aed935fe881b7ffba4cb71 100644 (file)
@@ -104,6 +104,7 @@ def _tests(
 
     # for sqlalchemy == "default", the alembic install will install
     # current released SQLAlchemy version as a dependency
+    shutil.rmtree("build/", ignore_errors=True)
     if coverage:
         session.install("-e", ".")
     else:
@@ -201,6 +202,7 @@ def _tests(
 def mypy_check(session: nox.Session) -> None:
     """Run mypy type checking."""
 
+    shutil.rmtree("build/", ignore_errors=True)
     session.install(*nox.project.dependency_groups(pyproject, "mypy"))
 
     session.install("-e", ".")
index 37c6e86a4f207dc95031b8596c0221aa0bcc3fd7..eb2676cee8c98f19f978be0b490ce0aa6ed9f7ca 100644 (file)
--- a/setup.cfg
+++ b/setup.cfg
@@ -29,6 +29,7 @@ sqlite=sqlite:///:memory:
 sqlite_file=sqlite:///querytest.db
 postgresql=postgresql://scott:tiger@127.0.0.1:5432/test
 psycopg=postgresql+psycopg://scott:tiger@127.0.0.1:5432/test
+psycopg2=postgresql+psycopg2://scott:tiger@127.0.0.1:5432/test
 mysql=mysql://scott:tiger@127.0.0.1:3306/test?charset=utf8mb4
 mariadb=mariadb://scott:tiger@127.0.0.1:3306/test?charset=utf8mb4
 mssql=mssql+pyodbc://scott:tiger^5HHH@mssql2022:1433/test?driver=ODBC+Driver+18+for+SQL+Server&TrustServerCertificate=yes&Encrypt=Optional
index 1ad5b967465602b6b4a0a2e5a8bc3043bf6489ed..0841c9a9973d5b69fcb66b8ac7a855138a60ec27 100644 (file)
@@ -72,7 +72,7 @@ class BulkInsertTest(TestBase):
         )
 
     def test_bulk_insert_wrong_cols(self):
-        context = op_fixture("postgresql")
+        context = op_fixture("postgresql+psycopg2")
         t1 = table(
             "ins_table",
             column("id", Integer),
@@ -92,14 +92,14 @@ class BulkInsertTest(TestBase):
         context.assert_()
 
     def test_bulk_insert_pg(self):
-        context = self._test_bulk_insert("postgresql", False)
+        context = self._test_bulk_insert("postgresql+psycopg2", False)
         context.assert_(
             "INSERT INTO ins_table (id, v1, v2) "
             "VALUES (%(id)s, %(v1)s, %(v2)s)"
         )
 
     def test_bulk_insert_pg_single(self):
-        context = self._test_bulk_insert_single("postgresql", False)
+        context = self._test_bulk_insert_single("postgresql+psycopg2", False)
         context.assert_(
             "INSERT INTO ins_table (id, v1, v2) "
             "VALUES (%(id)s, %(v1)s, %(v2)s)"