Skip to content

Commit 5f8b441

Browse files
sfc-gh-mkubiksfc-gh-pczajka
authored andcommitted
NO-SNOW Fix flaky query timeout test (#2266)
1 parent 0fffdb0 commit 5f8b441

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

test/integ/test_cursor.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from datetime import date, datetime, timezone
1515
from typing import TYPE_CHECKING, NamedTuple
1616
from unittest import mock
17-
from unittest.mock import MagicMock
1817

1918
import pytest
2019
import pytz
@@ -796,10 +795,11 @@ def test_timeout_query(conn_cnx):
796795
# we can not precisely control the timing to send cancel query request right after server
797796
# executes the query but before returning the results back to client
798797
# it depends on python scheduling and server processing speed, so we mock here
799-
with mock.patch.object(
800-
c, "_timebomb", new_callable=MagicMock
801-
) as mock_timerbomb:
802-
mock_timerbomb.executed = True
798+
with mock.patch(
799+
"snowflake.connector.cursor._TrackedQueryCancellationTimer",
800+
autospec=True,
801+
) as mock_timebomb:
802+
mock_timebomb.return_value.executed = True
803803
c.execute(
804804
"select 123'",
805805
timeout=0.1,

0 commit comments

Comments
 (0)