Skip to content

Commit

Permalink
test: Parameterize test for deletion without session to handle enviro…
Browse files Browse the repository at this point in the history
…nment variables
  • Loading branch information
zaramzamzam committed Nov 1, 2024
1 parent 3e52073 commit 1882296
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions libs/community/tests/unit_tests/chat_models/test_snowflake.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,18 @@ def test_session_handled_outside_not_closed() -> None:
mock_del.assert_called_once()
sp_session_mock.close.assert_not_called()


def test_del_called_without_session_provided() -> None:
@pytest.mark.parametrize(
"set_env_vars",
[{
"temp_env_vars": {
"SNOWFLAKE_USERNAME": "user",
"SNOWFLAKE_ACCOUNT": "account",
"SNOWFLAKE_PASSWORD": "password",
}
}],
indirect=["set_env_vars"],
)
def test_del_called_without_session_provided(set_env_vars: Any) -> None:
obj = ChatSnowflakeCortex()
with patch.object(
ChatSnowflakeCortex, "__del__", wraps=ChatSnowflakeCortex.__del__
Expand Down

0 comments on commit 1882296

Please sign in to comment.