From: Daniele Varrazzo Date: Sat, 28 Sep 2024 16:01:22 +0000 (+0200) Subject: test(crdb): fix or skip tests that now run because libpq 17 is available X-Git-Tag: 3.2.3~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=494bd6f0efcf1ba79df80d378b3cfd0a202631af;p=thirdparty%2Fpsycopg.git test(crdb): fix or skip tests that now run because libpq 17 is available --- diff --git a/tests/fix_crdb.py b/tests/fix_crdb.py index 554293f3d..b02aa2a36 100644 --- a/tests/fix_crdb.py +++ b/tests/fix_crdb.py @@ -90,6 +90,7 @@ _crdb_reasons = { "cancel": 41335, "cast adds tz": 51692, "cidr": 18846, + "close portal": None, "composite": 27792, "copy array": 82792, "copy canceled": 81559, diff --git a/tests/pq/test_async.py b/tests/pq/test_async.py index 6fd50e67f..aff6ccdf9 100644 --- a/tests/pq/test_async.py +++ b/tests/pq/test_async.py @@ -260,8 +260,8 @@ def test_send_describe_portal(pgconn): pgconn.send_describe_portal(b"cur") -@pytest.mark.crdb_skip("server-side cursor") @pytest.mark.libpq(">= 17") +@pytest.mark.crdb_skip("close portal") def test_send_close_portal(pgconn): res = pgconn.exec_( b""" diff --git a/tests/pq/test_exec.py b/tests/pq/test_exec.py index 2ba18f3a8..3a7372875 100644 --- a/tests/pq/test_exec.py +++ b/tests/pq/test_exec.py @@ -145,7 +145,7 @@ def test_close_prepared_no_close(pgconn): pgconn.close_prepared(b"cur") -@pytest.mark.crdb_skip("server-side cursor") +@pytest.mark.crdb_skip("close portal") def test_describe_portal(pgconn): res = pgconn.exec_( b""" @@ -165,7 +165,7 @@ def test_describe_portal(pgconn): pgconn.describe_portal(b"cur") -@pytest.mark.crdb_skip("server-side cursor") +@pytest.mark.crdb_skip("close portal") @pytest.mark.libpq(">= 17") def test_close_portal(pgconn): res = pgconn.exec_( diff --git a/tests/pq/test_pgconn.py b/tests/pq/test_pgconn.py index da2a310f2..1022ae17c 100644 --- a/tests/pq/test_pgconn.py +++ b/tests/pq/test_pgconn.py @@ -414,7 +414,7 @@ def cancellable_query(pgconn: PGconn) -> Iterator[None]: monitor_conn.status == pq.ConnStatus.OK ), f"bad connection: {monitor_conn.get_error_message()}" - pgconn.send_query_params(b"SELECT pg_sleep($1)", [b"180"]) + pgconn.send_query_params(b"SELECT pg_sleep($1)", [b"10"]) while True: r = monitor_conn.exec_( @@ -440,6 +440,7 @@ def cancellable_query(pgconn: PGconn) -> Iterator[None]: @pytest.mark.libpq(">= 17") +@pytest.mark.crdb("skip", reason="test hang - TODO investigate") def test_cancel_conn_blocking(pgconn): # test PQcancelBlocking, similarly to test_cancel() from # src/test/modules/libpq_pipeline/libpq_pipeline.c @@ -460,6 +461,7 @@ def test_cancel_conn_blocking(pgconn): @pytest.mark.libpq(">= 17") +@pytest.mark.crdb("skip", reason="test *might* hang - TODO investigate") def test_cancel_conn_nonblocking(pgconn): # test PQcancelStart() and then polling with PQcancelPoll, similarly to # test_cancel() from src/test/modules/libpq_pipeline/libpq_pipeline.c @@ -640,7 +642,9 @@ def test_trace_nonlinux(pgconn): @pytest.mark.libpq(">= 17") def test_change_password_error(pgconn): - with pytest.raises(psycopg.OperationalError, match='role "ashesh" does not exist'): + with pytest.raises( + psycopg.OperationalError, match='role(/user)? "ashesh" does not exist' + ): pgconn.change_password(b"ashesh", b"psycopg")