]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Catch the more generic DBAPIError exception instead of DataError
authorLele Gaifax <lele@metapensiero.it>
Thu, 10 Nov 2022 18:33:15 +0000 (19:33 +0100)
committerLele Gaifax <lele@metapensiero.it>
Thu, 10 Nov 2022 18:33:15 +0000 (19:33 +0100)
This should fix the issue with asyncpg.

test/dialect/postgresql/test_types.py

index 55afd2d18da3247d59d05b607cd7f26651c56627..6f8a0b9f34aab9eecf726d45075eb0a00294f6b4 100644 (file)
@@ -60,7 +60,7 @@ from sqlalchemy.dialects.postgresql import TSRANGE
 from sqlalchemy.dialects.postgresql import TSTZMULTIRANGE
 from sqlalchemy.dialects.postgresql import TSTZRANGE
 from sqlalchemy.exc import CompileError
-from sqlalchemy.exc import DataError
+from sqlalchemy.exc import DBAPIError
 from sqlalchemy.orm import declarative_base
 from sqlalchemy.orm import Session
 from sqlalchemy.sql import bindparam
@@ -4308,9 +4308,9 @@ class _RangeComparisonFixtures(_RangeTests):
 
         try:
             pg_res = connection.execute(q).scalar()
-        except DataError:
+        except DBAPIError:
             connection.rollback()
-            with expect_raises(DataError):
+            with expect_raises(DBAPIError):
                 connection.execute(validate_q).scalar()
             with expect_raises(ValueError):
                 r1.union(r2)
@@ -4359,9 +4359,9 @@ class _RangeComparisonFixtures(_RangeTests):
 
         try:
             pg_res = connection.execute(q).scalar()
-        except DataError:
+        except DBAPIError:
             connection.rollback()
-            with expect_raises(DataError):
+            with expect_raises(DBAPIError):
                 connection.execute(validate_q).scalar()
             with expect_raises(ValueError):
                 r1.difference(r2)