From: Daniele Varrazzo Date: Tue, 12 Jul 2022 23:29:19 +0000 (+0100) Subject: test: fix proxy-based tests confused by the PGHOST env var X-Git-Tag: 3.1~46 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cedfeebc4bc70414ae01bfea59b563f60c1d69ed;p=thirdparty%2Fpsycopg.git test: fix proxy-based tests confused by the PGHOST env var --- diff --git a/tests/fix_proxy.py b/tests/fix_proxy.py index 7101aac3d..e50f5ec05 100644 --- a/tests/fix_proxy.py +++ b/tests/fix_proxy.py @@ -1,3 +1,4 @@ +import os import time import socket import logging @@ -57,11 +58,9 @@ class Proxy: cdict = conninfo.conninfo_to_dict(server_dsn) # Get server params + host = cdict.get("host") or os.environ.get("PGHOST") + self.server_host = host if host and not host.startswith("/") else "localhost" self.server_port = cdict.get("port", "5432") - if "host" not in cdict or cdict["host"].startswith("/"): - self.server_host = "localhost" - else: - self.server_host = cdict["host"] # Get client params self.client_host = "localhost"