summaryrefslogtreecommitdiff
path: root/testtools/deferredruntest.py
diff options
context:
space:
mode:
authorJonathan Lange <jml@canonical.com>2010-10-26 14:15:01 -0400
committerJonathan Lange <jml@canonical.com>2010-10-26 14:15:01 -0400
commite1b82b72cd79a807168bc64102aedd6be234a3ba (patch)
tree5171361101da06bead13ac451ab79106b51a0592 /testtools/deferredruntest.py
parent295de056dcec34fd233875de3b19151311077395 (diff)
downloadtesttools-e1b82b72cd79a807168bc64102aedd6be234a3ba.tar.gz
Don't use inlineCallbacks, instead use deferredGenerator, since it works
on Python 2.4
Diffstat (limited to 'testtools/deferredruntest.py')
-rw-r--r--testtools/deferredruntest.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/testtools/deferredruntest.py b/testtools/deferredruntest.py
index 61ffcf8..6582eb7 100644
--- a/testtools/deferredruntest.py
+++ b/testtools/deferredruntest.py
@@ -77,7 +77,7 @@ class AsynchronousDeferredRunTest(RunTest):
return lambda case, handlers=None: AsynchronousDeferredRunTest(
case, handlers, reactor, timeout)
- @defer.inlineCallbacks
+ @defer.deferredGenerator
def _run_cleanups(self):
"""Run the cleanups on the test case.
@@ -87,13 +87,16 @@ class AsynchronousDeferredRunTest(RunTest):
"""
while self.case._cleanups:
f, args, kwargs = self.case._cleanups.pop()
+ d = defer.maybeDeferred(f, *args, **kwargs)
+ thing = defer.waitForDeferred(d)
+ yield thing
try:
- yield defer.maybeDeferred(f, *args, **kwargs)
+ thing.getResult()
except Exception:
exc_info = sys.exc_info()
self.case._report_traceback(exc_info)
last_exception = exc_info[1]
- defer.returnValue(last_exception)
+ yield last_exception
def _run_deferred(self):
"""Run the test, assuming everything in it is Deferred-returning.