Skip to content

Commit da778be

Browse files
sfc-gh-mkubiksfc-gh-pczajka
authored andcommitted
NO-SNOW Fix flaky query timeout test (#2266)
1 parent 9d0a391 commit da778be

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
@@ -846,10 +845,11 @@ def test_timeout_query(conn_cnx):
846845
# we can not precisely control the timing to send cancel query request right after server
847846
# executes the query but before returning the results back to client
848847
# it depends on python scheduling and server processing speed, so we mock here
849-
with mock.patch.object(
850-
c, "_timebomb", new_callable=MagicMock
851-
) as mock_timerbomb:
852-
mock_timerbomb.executed = True
848+
with mock.patch(
849+
"snowflake.connector.cursor._TrackedQueryCancellationTimer",
850+
autospec=True,
851+
) as mock_timebomb:
852+
mock_timebomb.return_value.executed = True
853853
c.execute(
854854
"select 123'",
855855
timeout=0.1,

0 commit comments

Comments
 (0)