]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
test: fix compatibility of tests with Python 3.8
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sat, 28 Sep 2024 11:52:57 +0000 (13:52 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Sat, 28 Sep 2024 23:19:29 +0000 (01:19 +0200)
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.

tests/pq/test_pgconn.py

index dd82f8d2b82461d7bb5cc28a7bb2b787a5f3ec63..da2a310f232a9a9a615754c1cb2affe9e7d32587 100644 (file)
@@ -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