[ooni-probe/master] Do not attach both an errback and callback in runner for better debugging

commit 45a1e07dbd226cc35919e78c97267dfca7e357a9 Author: Arturo Filastò <art@fuffa.org> Date: Sun Dec 9 00:49:30 2012 +0100 Do not attach both an errback and callback in runner for better debugging * Call finish on the yaml reporter once it has done it's run --- ooni/oonicli.py | 8 +++++++- ooni/reporter.py | 2 +- ooni/runner.py | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ooni/oonicli.py b/ooni/oonicli.py index 44334f0..b06bde9 100644 --- a/ooni/oonicli.py +++ b/ooni/oonicli.py @@ -87,6 +87,10 @@ def testsEnded(*arg, **kw): try: reactor.stop() except: pass +def testFailed(failure): + log.err("Failed in running a test inside a test list") + failure.printTraceback() + def runTestList(none, test_list): """ none: is always None. @@ -102,7 +106,8 @@ def runTestList(none, test_list): deck_dl.append(d1) d2 = defer.DeferredList(deck_dl) - d2.addBoth(testsEnded) + d2.addCallback(testsEnded) + d2.addErrback(testFailed) # Print every 5 second the list of current tests running l = task.LoopingCall(updateStatusBar) @@ -110,6 +115,7 @@ def runTestList(none, test_list): return d2 def errorRunningTests(failure): + log.err("There was an error in running a test") failure.printTraceback() def run(): diff --git a/ooni/reporter.py b/ooni/reporter.py index b5de29f..728c3f5 100644 --- a/ooni/reporter.py +++ b/ooni/reporter.py @@ -171,7 +171,7 @@ class OReporter(object): """ raise NotImplemented - def finish(): + def finish(self): pass def testDone(self, test, test_name): diff --git a/ooni/runner.py b/ooni/runner.py index 77d7e7d..4ebfa0b 100644 --- a/ooni/runner.py +++ b/ooni/runner.py @@ -451,6 +451,7 @@ def runTestCases(test_cases, options, cmd_line_options): except Exception: log.exception("Problem in running test") + yaml_reporter.finish() class UnableToStartTor(Exception): pass
participants (1)
-
art@torproject.org