From: Daniele Varrazzo Date: Sat, 28 Sep 2024 11:52:57 +0000 (+0200) Subject: test: fix compatibility of tests with Python 3.8 X-Git-Tag: 3.2.3~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=48bce957df5fc83d5c5021289ab60db530ddd3ce;p=thirdparty%2Fpsycopg.git test: fix compatibility of tests with Python 3.8 Avoid using the |= operator on dictionaries, which is unsupported on Python 3.8. The test started mysteriously to fail... Turned out that it hadn't run so far on Python 3.8 because the "latest" libpq was v16, but when it switched to v17 it started to be executed. --- diff --git a/tests/pq/test_pgconn.py b/tests/pq/test_pgconn.py index dd82f8d2b..da2a310f2 100644 --- a/tests/pq/test_pgconn.py +++ b/tests/pq/test_pgconn.py @@ -660,11 +660,7 @@ def role(pgconn: PGconn) -> Iterator[tuple[bytes, bytes]]: def test_change_password(pgconn, dsn, role): user, passwd = role conninfo = {e.keyword: e.val for e in pq.Conninfo.parse(dsn.encode()) if e.val} - conninfo |= { - b"dbname": b"postgres", - b"user": user, - b"password": passwd, - } + conninfo.update({b"dbname": b"postgres", b"user": user, b"password": passwd}) conn = pq.PGconn.connect(b" ".join(b"%s='%s'" % item for item in conninfo.items())) assert conn.status == pq.ConnStatus.OK, conn.error_message