diff --git a/tests/Promise.py b/tests/Promise.py index 51aab6b6..ca8e2813 100644 --- a/tests/Promise.py +++ b/tests/Promise.py @@ -7,6 +7,7 @@ from enum import Enum class PromiseResultType(Enum): Result = 1 Exception = 2 + Traceback = 3 class Promise(object): @@ -24,7 +25,14 @@ class Promise(object): res = self._queue.get(timeout=timeout) if res[0] == PromiseResultType.Result: return res[1] - raise res[1] + elif res[0] == PromiseResultType.Exception: + raise res[1] + else: + et, ev, tb = res[1] + raise et, ev, tb - def set_exception(self, val): - self._queue.put((PromiseResultType.Exception, val)) + def set_exception(self, valueOrType, val=None, tb=None): + if val is None: + self._queue.put((PromiseResultType.Exception, val)) + else: + self._queue.put((PromiseResultType.Traceback, (valueOrType, val, tb)))