From: Lele Gaifax Date: Thu, 10 Nov 2022 18:33:15 +0000 (+0100) Subject: Catch the more generic DBAPIError exception instead of DataError X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=84c1ba21d84a08421a9d18399570d8e962168bd4;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Catch the more generic DBAPIError exception instead of DataError This should fix the issue with asyncpg. --- diff --git a/test/dialect/postgresql/test_types.py b/test/dialect/postgresql/test_types.py index 55afd2d18d..6f8a0b9f34 100644 --- a/test/dialect/postgresql/test_types.py +++ b/test/dialect/postgresql/test_types.py @@ -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)