From: Daniele Varrazzo Date: Sat, 5 Aug 2023 19:53:35 +0000 (+0100) Subject: test(crdb): accept different exception on multi-query prepare attempt X-Git-Tag: pool-3.2.0~67^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2c8e287f6ef73a723bc60990c6713db8e4bfa869;p=thirdparty%2Fpsycopg.git test(crdb): accept different exception on multi-query prepare attempt --- diff --git a/tests/test_default_cursor.py b/tests/test_default_cursor.py index e9bebecda..92be4461b 100644 --- a/tests/test_default_cursor.py +++ b/tests/test_default_cursor.py @@ -4,7 +4,7 @@ Tests for psycopg.Cursor that are not supposed to pass for subclasses. import pytest import psycopg -from psycopg import pq, rows +from psycopg import pq, rows, errors as e from psycopg.adapt import PyFormat from .utils import gc_collect, gc_count @@ -28,7 +28,8 @@ def test_str(conn): def test_execute_many_results_param(conn): cur = conn.cursor() - with pytest.raises(psycopg.errors.SyntaxError): + # Postgres raises SyntaxError, CRDB raises InvalidPreparedStatementDefinition + with pytest.raises((e.SyntaxError, e.InvalidPreparedStatementDefinition)): cur.execute("select %s; select generate_series(1, %s)", ("foo", 3)) diff --git a/tests/test_default_cursor_async.py b/tests/test_default_cursor_async.py index c3057f58e..64c5bfad5 100644 --- a/tests/test_default_cursor_async.py +++ b/tests/test_default_cursor_async.py @@ -4,7 +4,7 @@ Tests for psycopg.Cursor that are not supposed to pass for subclasses. import pytest import psycopg -from psycopg import pq, rows +from psycopg import pq, rows, errors as e from psycopg.adapt import PyFormat from .utils import gc_collect, gc_count @@ -30,7 +30,8 @@ async def test_str(aconn): async def test_execute_many_results_param(aconn): cur = aconn.cursor() - with pytest.raises(psycopg.errors.SyntaxError): + # Postgres raises SyntaxError, CRDB raises InvalidPreparedStatementDefinition + with pytest.raises((e.SyntaxError, e.InvalidPreparedStatementDefinition)): await cur.execute("select %s; select generate_series(1, %s)", ("foo", 3))