From 1882296d8aeb2c0a0b8445a11ee9e28074ce0665 Mon Sep 17 00:00:00 2001 From: zaramzamzam Date: Fri, 1 Nov 2024 09:57:55 +0100 Subject: [PATCH] test: Parameterize test for deletion without session to handle environment variables --- .../tests/unit_tests/chat_models/test_snowflake.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/libs/community/tests/unit_tests/chat_models/test_snowflake.py b/libs/community/tests/unit_tests/chat_models/test_snowflake.py index 7a9d521bd6c77e..16e5e2cc8336e5 100644 --- a/libs/community/tests/unit_tests/chat_models/test_snowflake.py +++ b/libs/community/tests/unit_tests/chat_models/test_snowflake.py @@ -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__