Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4e04b7d

Browse files
1 parent feb63d4 commit 4e04b7d

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

‎google/api_core/retry.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,9 @@ def retry_target(
204204
try:
205205
result = target()
206206
if inspect.isawaitable(result):
207-
raise exceptions.GoogleAPICallError("Warning: Using the synchronous google.api_core.retry.Retry with asynchronous calls may lead to unexpected results. Please use google.api_core.retry_async.AsyncRetry instead.")
207+
raise exceptions.GoogleAPICallError(
208+
"Warning: Using the synchronous google.api_core.retry.Retry with asynchronous calls may lead to unexpected results. Please use google.api_core.retry_async.AsyncRetry instead."
209+
)
208210
return result
209211

210212
# pylint: disable=broad-except

‎tests/asyncio/test_retry_async.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ async def test_retry_target_non_retryable_error(utcnow, sleep):
9696
assert exc_info.value == exception
9797
sleep.assert_not_called()
9898

99+
99100
@mock.patch("asyncio.sleep", autospec=True)
100101
@mock.patch(
101102
"google.api_core.datetime_helpers.utcnow",
@@ -110,7 +111,9 @@ async def test_retry_target_warning_for_retry(utcnow, sleep):
110111
with pytest.raises(exceptions.GoogleAPICallError) as exc_info:
111112
retry.retry_target(target, predicate, range(10), None)
112113

113-
assert exc_info.match("Warning: Use google.api_core.retry_async.AsyncRetry for async calls!")
114+
assert exc_info.match(
115+
"Warning: Use google.api_core.retry_async.AsyncRetry for async calls!"
116+
)
114117
assert exc_info.type == exceptions.GoogleAPICallError
115118
sleep.assert_not_called()
116119

0 commit comments

Comments
 (0)