@@ -38,18 +38,27 @@ def test_execute_query(
3838 def test_execute_query_with_exception (
3939 self , mock_snowflake_conn , test_instance , mocker ):
4040 test_instance .connect ()
41+ test_conn = test_instance .conn
4142
4243 mock_cursor = mocker .MagicMock ()
4344 mock_cursor .execute .side_effect = Exception ()
44- test_instance . conn .cursor .return_value = mock_cursor
45+ test_conn .cursor .return_value = mock_cursor
4546
4647 with pytest .raises (SnowflakeClientError ):
4748 test_instance .execute_query ('test query' )
4849
4950 mock_cursor .close .assert_called ()
50- test_instance .conn .close .assert_called_once ()
51+ test_conn .close .assert_called_once ()
52+
53+ def test_close_connection (self , mock_snowflake_conn , test_instance , mocker ):
54+ assert test_instance .conn is None
5155
52- def test_close_connection (self , mock_snowflake_conn , test_instance ):
5356 test_instance .connect ()
57+
58+ test_conn = test_instance .conn
59+ assert test_conn is not None
60+
5461 test_instance .close_connection ()
55- test_instance .conn .close .assert_called_once ()
62+
63+ test_conn .close .assert_called_once ()
64+ assert test_instance .conn is None
0 commit comments