]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
test(crdb): accept different exception on multi-query prepare attempt
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sat, 5 Aug 2023 19:53:35 +0000 (20:53 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Thu, 10 Aug 2023 00:43:40 +0000 (01:43 +0100)
tests/test_default_cursor.py
tests/test_default_cursor_async.py

index e9bebecdae67982d74ae1475df9d576a6f981bd0..92be4461b7b3a673badef01b11b84804134890a5 100644 (file)
@@ -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))
 
 
index c3057f58e104f7484f66ba2cd1b5a0f0be8d1f25..64c5bfad5585004b324f4a324274ff2973cbf710 100644 (file)
@@ -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))