From: Jelte Fennema Date: Tue, 1 Aug 2023 12:39:32 +0000 (+0200) Subject: test: add tests for close_prepared/portal for unsupported libpq X-Git-Tag: pool-3.2.0~76^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=320701b8231c62d05dbcd98b8c0ec7d401fb101b;p=thirdparty%2Fpsycopg.git test: add tests for close_prepared/portal for unsupported libpq --- diff --git a/tests/pq/test_async.py b/tests/pq/test_async.py index c47729c5a..e529eb743 100644 --- a/tests/pq/test_async.py +++ b/tests/pq/test_async.py @@ -205,6 +205,12 @@ def test_send_close_prepared(pgconn): assert res.status == pq.ExecStatus.FATAL_ERROR +@pytest.mark.libpq("< 17") +def test_send_close_prepared_no_close(pgconn): + with pytest.raises(psycopg.NotSupportedError): + pgconn.send_close_prepared(b"prep") + + @pytest.mark.crdb_skip("server-side cursor") def test_send_describe_portal(pgconn): res = pgconn.exec_( @@ -245,3 +251,9 @@ def test_send_close_portal(pgconn): pgconn.send_describe_portal(b"cur") (res,) = execute_wait(pgconn) assert res.status == pq.ExecStatus.FATAL_ERROR + + +@pytest.mark.libpq("< 17") +def test_send_close_portal_no_close(pgconn): + with pytest.raises(psycopg.NotSupportedError): + pgconn.send_close_portal(b"cur") diff --git a/tests/pq/test_exec.py b/tests/pq/test_exec.py index 24bbe7087..2ba18f3a8 100644 --- a/tests/pq/test_exec.py +++ b/tests/pq/test_exec.py @@ -139,6 +139,12 @@ def test_close_prepared(pgconn): assert res.status == pq.ExecStatus.FATAL_ERROR +@pytest.mark.libpq("< 17") +def test_close_prepared_no_close(pgconn): + with pytest.raises(psycopg.NotSupportedError): + pgconn.close_prepared(b"cur") + + @pytest.mark.crdb_skip("server-side cursor") def test_describe_portal(pgconn): res = pgconn.exec_( @@ -176,3 +182,9 @@ def test_close_portal(pgconn): # Because we closed it, describing should not work res = pgconn.describe_portal(b"cur") assert res.status == pq.ExecStatus.FATAL_ERROR + + +@pytest.mark.libpq("< 17") +def test_close_portal_no_close(pgconn): + with pytest.raises(psycopg.NotSupportedError): + pgconn.close_portal(b"cur")