Skip to content

Commit d3aea87

Browse files
fix old driver tests
1 parent 610a6e5 commit d3aea87

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

test/integ/conftest.py

+21-8
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,15 @@
1717

1818
import snowflake.connector
1919
from snowflake.connector.compat import IS_WINDOWS
20-
from snowflake.connector.config_manager import CONFIG_MANAGER
2120
from snowflake.connector.connection import DefaultConverterClass
2221

2322
from .. import running_on_public_ci
2423

24+
try:
25+
from snowflake.connector.config_manager import CONFIG_MANAGER
26+
except ImportError:
27+
CONFIG_MANAGER = None
28+
2529
try:
2630
from ..parameters import CONNECTION_PARAMETERS
2731
except ImportError:
@@ -118,14 +122,23 @@ def get_db_parameters(connection_name: str = "default") -> dict[str, Any]:
118122
os.environ["TZ"] = "UTC"
119123
if not IS_WINDOWS:
120124
time.tzset()
121-
cm_connection_name = (
122-
CONFIG_MANAGER["default_connection_name"]
123-
if connection_name == "default"
124-
else connection_name
125-
)
126-
if cm_connection_name in CONFIG_MANAGER["connections"]:
125+
if (
126+
CONFIG_MANAGER is not None
127+
and (
128+
CONFIG_MANAGER["default_connection_name"]
129+
if connection_name == "default"
130+
else connection_name
131+
)
132+
in CONFIG_MANAGER["connections"]
133+
):
127134
# If config_manager knows of this connection then use it
128-
ret = CONFIG_MANAGER["connections"][cm_connection_name].value.value
135+
ret = CONFIG_MANAGER["connections"][
136+
(
137+
CONFIG_MANAGER["default_connection_name"]
138+
if connection_name == "default"
139+
else connection_name
140+
)
141+
].value.value
129142
else:
130143
connections = {
131144
"default": CONNECTION_PARAMETERS,

0 commit comments

Comments
 (0)