Skip to content

Commit

Permalink
fix old driver tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-mkeller committed Nov 7, 2024
1 parent 610a6e5 commit d3aea87
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions test/integ/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@

import snowflake.connector
from snowflake.connector.compat import IS_WINDOWS
from snowflake.connector.config_manager import CONFIG_MANAGER
from snowflake.connector.connection import DefaultConverterClass

from .. import running_on_public_ci

try:
from snowflake.connector.config_manager import CONFIG_MANAGER
except ImportError:
CONFIG_MANAGER = None

try:
from ..parameters import CONNECTION_PARAMETERS
except ImportError:
Expand Down Expand Up @@ -118,14 +122,23 @@ def get_db_parameters(connection_name: str = "default") -> dict[str, Any]:
os.environ["TZ"] = "UTC"
if not IS_WINDOWS:
time.tzset()
cm_connection_name = (
CONFIG_MANAGER["default_connection_name"]
if connection_name == "default"
else connection_name
)
if cm_connection_name in CONFIG_MANAGER["connections"]:
if (
CONFIG_MANAGER is not None
and (
CONFIG_MANAGER["default_connection_name"]
if connection_name == "default"
else connection_name
)
in CONFIG_MANAGER["connections"]
):
# If config_manager knows of this connection then use it
ret = CONFIG_MANAGER["connections"][cm_connection_name].value.value
ret = CONFIG_MANAGER["connections"][
(
CONFIG_MANAGER["default_connection_name"]
if connection_name == "default"
else connection_name
)
].value.value
else:
connections = {
"default": CONNECTION_PARAMETERS,
Expand Down

0 comments on commit d3aea87

Please sign in to comment.