From cedfeebc4bc70414ae01bfea59b563f60c1d69ed Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Wed, 13 Jul 2022 00:29:19 +0100 Subject: [PATCH] test: fix proxy-based tests confused by the PGHOST env var --- tests/fix_proxy.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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" -- 2.47.2