]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
test(crdb): fix or skip tests that now run because libpq 17 is available
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sat, 28 Sep 2024 16:01:22 +0000 (18:01 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sat, 28 Sep 2024 23:19:42 +0000 (01:19 +0200)
tests/fix_crdb.py
tests/pq/test_async.py
tests/pq/test_exec.py
tests/pq/test_pgconn.py

index 554293f3d0f562016c84aee89a5146616cf91cbc..b02aa2a36afbc4d64770dea60c9cecd6d172c097 100644 (file)
@@ -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,
index 6fd50e67f98f637c0c09a7277bc5b83a799d6cd8..aff6ccdf9fae8966f0fddd46883c0145d88cb715 100644 (file)
@@ -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"""
index 2ba18f3a880ff709648d482dfb7d6d07ca04143b..3a73728758d2c8af9e03e0908ae970218cdf62b7 100644 (file)
@@ -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_(
index da2a310f232a9a9a615754c1cb2affe9e7d32587..1022ae17cfc3c9e968e606c9cb431dc0959e893f 100644 (file)
@@ -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")