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

Skip to content

Commit 95bcc0f

Browse files
1 parent 87fa112 commit 95bcc0f

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.GoogleAPIError("Warning: Use google.api_core.retry_async.AsyncRetry for async calls!")
207+
raise exceptions.GoogleAPIError(
208+
"Warning: Use google.api_core.retry_async.AsyncRetry for async calls!"
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",
@@ -105,7 +106,9 @@ async def test_retry_target_non_retryable_error(utcnow, sleep):
105106
@pytest.mark.asyncio
106107
async def test_retry_target_warning_for_retry(utcnow, sleep):
107108
predicate = retry.if_exception_type(exceptions.GoogleAPICallError)
108-
exception = exceptions.GoogleAPICallError("Warning: Use google.api_core.retry_async.AsyncRetry for async calls!")
109+
exception = exceptions.GoogleAPICallError(
110+
"Warning: Use google.api_core.retry_async.AsyncRetry for async calls!"
111+
)
109112
target = mock.Mock(side_effect=exception)
110113

111114
with pytest.raises(exceptions.GoogleAPICallError) as exc_info:

0 commit comments

Comments
 (0)