@@ -1105,11 +1105,11 @@ async def test_disable_query_context_cache(conn_cnx) -> None:
11051105
11061106
11071107@pytest .mark .skipolddriver
1108- @pytest .mark .parametrize (
1109- "mode" ,
1110- ( "file" , "env" ),
1111- )
1112- async def test_connection_name_loading ( monkeypatch , db_parameters , tmp_path , mode ):
1108+ @pytest .mark .parametrize ("mode" , ( "file" , "env" ))
1109+ @ pytest . mark . parametrize ( "connection_name" , [ "default" , "custom_connection_for_test" ])
1110+ async def test_connection_name_loading (
1111+ monkeypatch , db_parameters , tmp_path , mode , connection_name
1112+ ):
11131113 import tomlkit
11141114
11151115 doc = tomlkit .document ()
@@ -1119,16 +1119,16 @@ async def test_connection_name_loading(monkeypatch, db_parameters, tmp_path, mod
11191119 # If anything unexpected fails here, don't want to expose password
11201120 for k , v in db_parameters .items ():
11211121 default_con [k ] = v
1122- doc ["default" ] = default_con
1122+ doc [connection_name ] = default_con
11231123 with monkeypatch .context () as m :
11241124 if mode == "env" :
1125- m .setenv ("SF_CONNECTIONS " , tomlkit .dumps (doc ))
1125+ m .setenv ("SNOWFLAKE_CONNECTIONS " , tomlkit .dumps (doc ))
11261126 else :
11271127 tmp_connections_file = tmp_path / "connections.toml"
11281128 tmp_connections_file .write_text (tomlkit .dumps (doc ))
11291129 tmp_connections_file .chmod (stat .S_IRUSR | stat .S_IWUSR )
11301130 async with snowflake .connector .aio .SnowflakeConnection (
1131- connection_name = "default" ,
1131+ connection_name = connection_name ,
11321132 connections_file_path = tmp_connections_file ,
11331133 ) as conn :
11341134 async with conn .cursor () as cur :
@@ -1143,7 +1143,10 @@ async def test_connection_name_loading(monkeypatch, db_parameters, tmp_path, mod
11431143
11441144
11451145@pytest .mark .skipolddriver
1146- async def test_default_connection_name_loading (monkeypatch , db_parameters ):
1146+ @pytest .mark .parametrize ("connection_name" , ["default" , "custom_connection_for_test" ])
1147+ async def test_default_connection_name_loading (
1148+ monkeypatch , db_parameters , connection_name
1149+ ):
11471150 import tomlkit
11481151
11491152 doc = tomlkit .document ()
@@ -1152,10 +1155,10 @@ async def test_default_connection_name_loading(monkeypatch, db_parameters):
11521155 # If anything unexpected fails here, don't want to expose password
11531156 for k , v in db_parameters .items ():
11541157 default_con [k ] = v
1155- doc ["default" ] = default_con
1158+ doc [connection_name ] = default_con
11561159 with monkeypatch .context () as m :
11571160 m .setenv ("SNOWFLAKE_CONNECTIONS" , tomlkit .dumps (doc ))
1158- m .setenv ("SNOWFLAKE_DEFAULT_CONNECTION_NAME" , "default" )
1161+ m .setenv ("SNOWFLAKE_DEFAULT_CONNECTION_NAME" , connection_name )
11591162 async with snowflake .connector .aio .SnowflakeConnection () as conn :
11601163 async with conn .cursor () as cur :
11611164 assert await (await cur .execute ("select 1;" )).fetchall () == [
0 commit comments