From b944734789160f65418eadd3893664099042d65e Mon Sep 17 00:00:00 2001 From: Marcel <62351477+lezram@users.noreply.github.com> Date: Fri, 14 Apr 2023 20:20:13 +0200 Subject: [PATCH 1/3] fix: allow host tuple --- asyncpg/connect_utils.py | 2 +- tests/test_connect.py | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/asyncpg/connect_utils.py b/asyncpg/connect_utils.py index 4d1a3f7d..5f6423c2 100644 --- a/asyncpg/connect_utils.py +++ b/asyncpg/connect_utils.py @@ -395,7 +395,7 @@ def _parse_connect_dsn_and_args(*, dsn, host, port, user, host = ['/run/postgresql', '/var/run/postgresql', '/tmp', '/private/tmp', 'localhost'] - if not isinstance(host, list): + if not isinstance(host, (list, tuple)): host = [host] if auth_hosts is None: diff --git a/tests/test_connect.py b/tests/test_connect.py index a939db50..d5cdb18f 100644 --- a/tests/test_connect.py +++ b/tests/test_connect.py @@ -607,6 +607,19 @@ class TestConnectParams(tb.TestCase): 'user': 'foo', }) }, + + { + 'name': 'params_multi_host_dsn_env_mix_tuple', + 'env': { + 'PGUSER': 'foo', + }, + 'dsn': 'postgresql:///db', + 'host': ('host1', 'host2'), + 'result': ([('host1', 5432), ('host2', 5432)], { + 'database': 'db', + 'user': 'foo', + }) + }, { 'name': 'params_combine_dsn_settings_override_and_ssl', From 3845088943609568ccf9ca4b20c286d90ca67179 Mon Sep 17 00:00:00 2001 From: Elvis Pranskevichus Date: Mon, 9 Oct 2023 13:48:01 -0700 Subject: [PATCH 2/3] Update tests/test_connect.py --- tests/test_connect.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/test_connect.py b/tests/test_connect.py index b811089a..ff920cad 100644 --- a/tests/test_connect.py +++ b/tests/test_connect.py @@ -682,6 +682,7 @@ class TestConnectParams(tb.TestCase): 'result': ([('host1', 5432), ('host2', 5432)], { 'database': 'db', 'user': 'foo', + 'target_session_attrs': 'any', }) }, From 2f7a1e47245ec1f1e1b56ccb73e6ee5490b224b1 Mon Sep 17 00:00:00 2001 From: Elvis Pranskevichus Date: Mon, 9 Oct 2023 13:59:39 -0700 Subject: [PATCH 3/3] Update tests/test_connect.py --- tests/test_connect.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_connect.py b/tests/test_connect.py index ff920cad..5333e2c5 100644 --- a/tests/test_connect.py +++ b/tests/test_connect.py @@ -671,7 +671,6 @@ class TestConnectParams(tb.TestCase): 'target_session_attrs': 'any', }) }, - { 'name': 'params_multi_host_dsn_env_mix_tuple', 'env': { pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy