Skip to content

Commit 1b42d94

Browse files
authored
Forward 'timeout' arg from 'exception' to '_blocking_poll'. (#8735)
Closes #8733.
1 parent f6cda97 commit 1b42d94

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

google/api_core/future/polling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def exception(self, timeout=None):
139139
Optional[google.api_core.GoogleAPICallError]: The operation's
140140
error.
141141
"""
142-
self._blocking_poll()
142+
self._blocking_poll(timeout=timeout)
143143
return self._exception
144144

145145
def add_done_callback(self, fn):

tests/unit/future/test_polling.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,12 @@ def test_result_timeout():
119119
future.result(timeout=1)
120120

121121

122+
def test_exception_timeout():
123+
future = PollingFutureImplTimeout()
124+
with pytest.raises(concurrent.futures.TimeoutError):
125+
future.exception(timeout=1)
126+
127+
122128
class PollingFutureImplTransient(PollingFutureImplWithPoll):
123129
def __init__(self, errors):
124130
super(PollingFutureImplTransient, self).__init__()

0 commit comments

Comments
 (0)