File tree Expand file tree Collapse file tree 3 files changed +400
-57
lines changed
test_utils/cross_module_fixtures Expand file tree Collapse file tree 3 files changed +400
-57
lines changed Original file line number Diff line number Diff line change 22
33import pytest
44
5+ from snowflake .connector .compat import urlparse as compat_urlparse
6+ from snowflake .connector .session_manager import SessionManager
7+
58
69@pytest .fixture
710def proxy_env_vars ():
@@ -42,3 +45,23 @@ def clear_proxy_env_vars():
4245 os .environ ["NO_PROXY" ] = original_no_proxy
4346 elif "NO_PROXY" in os .environ :
4447 del os .environ ["NO_PROXY" ]
48+
49+
50+ @pytest .fixture
51+ def host_port_pooling (monkeypatch ):
52+
53+ def get_pooling_key_as_host_with_port (url : str ) -> str :
54+ """
55+ Test-only override to derive pooling key as "host:port" if port is specified.
56+ """
57+ parsed = compat_urlparse (url )
58+ host = parsed .hostname
59+ port = parsed .port
60+ return f"{ host } :{ port } " if port else host
61+
62+ monkeypatch .setattr (
63+ SessionManager ,
64+ "_get_pooling_key_from_url" ,
65+ staticmethod (get_pooling_key_as_host_with_port ),
66+ )
67+ yield
You can’t perform that action at this time.
0 commit comments