Skip to content

Commit 9272a49

Browse files
committed
pass init_args_for_pool_manager in constructor
1 parent 906f44b commit 9272a49

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

py/selenium/webdriver/remote/remote_connection.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,9 @@ def _separate_http_proxy_auth(self):
241241
proxy_without_auth = protocol + no_protocol[len(auth) + 1 :]
242242
return proxy_without_auth, auth
243243

244-
def _get_connection_manager(self, **pool_manager_kwargs):
244+
def _get_connection_manager(self):
245245
pool_manager_init_args = {"timeout": self.get_timeout()}
246-
pool_manager_init_args.update(pool_manager_kwargs.get("init_args_for_pool_manager", {}))
246+
pool_manager_init_args.update(self._init_args_for_pool_manager.get("init_args_for_pool_manager", {}))
247247

248248
if self._ignore_certificates:
249249
pool_manager_init_args["cert_reqs"] = "CERT_NONE"
@@ -270,10 +270,12 @@ def __init__(
270270
keep_alive: bool = False,
271271
ignore_proxy: bool = False,
272272
ignore_certificates: bool = False,
273+
init_args_for_pool_manager: dict = None,
273274
):
274275
self.keep_alive = keep_alive
275276
self._url = remote_server_addr
276277
self._ignore_certificates = ignore_certificates
278+
self._init_args_for_pool_manager = init_args_for_pool_manager or {}
277279

278280
# Env var NO_PROXY will override this part of the code
279281
_no_proxy = os.environ.get("no_proxy", os.environ.get("NO_PROXY"))

py/test/unit/selenium/webdriver/remote/remote_connection_tests.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,9 +304,9 @@ def test_get_connection_manager_ignores_certificates(monkeypatch):
304304

305305

306306
def test_get_connection_manager_with_custom_args():
307-
custom_args = {"retries": 3, "block": True}
308-
remote_connection = RemoteConnection("http://remote", keep_alive=False)
309-
conn = remote_connection._get_connection_manager(init_args_for_pool_manager=custom_args)
307+
custom_args = {"init_args_for_pool_manager": {"retries": 3, "block": True}}
308+
remote_connection = RemoteConnection("http://remote", keep_alive=False, init_args_for_pool_manager=custom_args)
309+
conn = remote_connection._get_connection_manager()
310310

311311
assert isinstance(conn, urllib3.PoolManager)
312312
assert conn.connection_pool_kw["retries"] == 3

0 commit comments

Comments
 (0)