Forward 'timeout' arg from 'exception' to '_blocking_poll'. (#8735)
Closes #8733.
diff --git a/google/api_core/future/polling.py b/google/api_core/future/polling.py
index 843fba0..4266e9e 100644
--- a/google/api_core/future/polling.py
+++ b/google/api_core/future/polling.py
@@ -139,7 +139,7 @@
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):
diff --git a/tests/unit/future/test_polling.py b/tests/unit/future/test_polling.py
index 3e19d07..c67de06 100644
--- a/tests/unit/future/test_polling.py
+++ b/tests/unit/future/test_polling.py
@@ -119,6 +119,12 @@
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__()