Eases debugging of tracebacks.
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
Sets the whole completion to be faild with this exception and end the
evaluation.
"""
+ if self._state == self.FINISHED:
+ raise ValueError(
+ 'Invalid State: called fail, but Completion is already finished: {}'.format(str(e)))
assert self._state in (self.INITIALIZED, self.RUNNING)
logger.exception('_Promise failed')
self._exception = e
c._first_promise.fail(KeyError())
assert isinstance(c.exception, KeyError)
+ with pytest.raises(ValueError,
+ match='Invalid State: called fail, but Completion is already finished: {}'.format(
+ str(ZeroDivisionError()))):
+ c._first_promise.fail(ZeroDivisionError())
+
def test_pretty_print():
mgr = mock.MagicMock()