Skip to content

Commit b33def0

Browse files
NO-SNOW Fix flaky query timeout test (#2266)
1 parent 05434dd commit b33def0

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
@@ -11,7 +11,6 @@
1111
from datetime import date, datetime, timezone
1212
from typing import TYPE_CHECKING, NamedTuple
1313
from unittest import mock
14-
from unittest.mock import MagicMock
1514

1615
import pytest
1716
import pytz
@@ -843,10 +842,11 @@ def test_timeout_query(conn_cnx):
843842
# we can not precisely control the timing to send cancel query request right after server
844843
# executes the query but before returning the results back to client
845844
# it depends on python scheduling and server processing speed, so we mock here
846-
with mock.patch.object(
847-
c, "_timebomb", new_callable=MagicMock
848-
) as mock_timerbomb:
849-
mock_timerbomb.executed = True
845+
with mock.patch(
846+
"snowflake.connector.cursor._TrackedQueryCancellationTimer",
847+
autospec=True,
848+
) as mock_timebomb:
849+
mock_timebomb.return_value.executed = True
850850
c.execute(
851851
"select 123'",
852852
timeout=0.1,

0 commit comments

Comments
 (0)