Skip to content

Commit cd8c39e

Browse files
author
Chris Rossi
authored
fix: mock call to tasklets.sleep in unit test (#609)
Fixes #608
1 parent 2f261b7 commit cd8c39e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

packages/google-cloud-ndb/tests/unit/test__retry.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@
2828
from . import utils
2929

3030

31+
def mock_sleep(seconds):
32+
future = tasklets.Future()
33+
future.set_result(None)
34+
return future
35+
36+
3137
class Test_retry:
3238
@staticmethod
3339
@pytest.mark.usefixtures("in_context")
@@ -54,6 +60,7 @@ def nested_callback():
5460
assert retry().result() == "foo"
5561

5662
@staticmethod
63+
@mock.patch("google.cloud.ndb.tasklets.sleep", mock_sleep)
5764
@pytest.mark.usefixtures("in_context")
5865
def test_nested_retry_with_exception():
5966
error = Exception("Fail")

0 commit comments

Comments
 (0)