Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Core: Forward 'timeout' arg from 'exception' to '_blocking_poll'. #8735

Merged
merged 1 commit into from
Jul 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api_core/google/api_core/future/polling.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def exception(self, timeout=None):
Optional[google.api_core.GoogleAPICallError]: The operation's
error.
"""
self._blocking_poll()
self._blocking_poll(timeout=timeout)
return self._exception

def add_done_callback(self, fn):
Expand Down
6 changes: 6 additions & 0 deletions api_core/tests/unit/future/test_polling.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ def test_result_timeout():
future.result(timeout=1)


def test_exception_timeout():
future = PollingFutureImplTimeout()
with pytest.raises(concurrent.futures.TimeoutError):
future.exception(timeout=1)


class PollingFutureImplTransient(PollingFutureImplWithPoll):
def __init__(self, errors):
super(PollingFutureImplTransient, self).__init__()
Expand Down