Skip to content

Commit ab39d41

Browse files
committed
Fix StopIteration in snowflake sql tests
1 parent fb94109 commit ab39d41

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

providers/snowflake/tests/unit/snowflake/hooks/test_snowflake_sql_api.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,7 +1107,9 @@ def test_wait_for_query_timeout_error(self, sleep_mock, time_mock):
11071107

11081108
# Simulate a query that keeps running and never finishes
11091109
hook.get_sql_api_query_status = mock.MagicMock(return_value={"status": "running"})
1110-
time_mock.side_effect = list(range(5))
1110+
1111+
# More side effects to ensure we hit the timeout and avoid StopIteration error
1112+
time_mock.side_effect = list(range(10))
11111113

11121114
qid = "qid-789"
11131115
timeout = 3
@@ -1120,7 +1122,7 @@ def test_wait_for_query_timeout_error(self, sleep_mock, time_mock):
11201122
sleep_mock.assert_has_calls([mock.call(1)] * 3)
11211123
assert hook.get_sql_api_query_status.call_count == 4
11221124
hook.get_sql_api_query_status.assert_has_calls([mock.call(query_id=qid)] * 4)
1123-
assert time_mock.call_count == 5
1125+
assert time_mock.call_count >= 3
11241126

11251127
@mock.patch(f"{HOOK_PATH}._make_api_call_with_retries")
11261128
@mock.patch(f"{HOOK_PATH}._process_response")

0 commit comments

Comments
 (0)