[tor-commits] [stem/master] Unexpected exceptions during async tests deadlocked

atagar at torproject.org atagar at torproject.org
Fri Jul 14 04:44:53 UTC 2017


commit 7901ff113353b9a62e9bf99682eb45933c1fcbcd
Author: Damian Johnson <atagar at torproject.org>
Date:   Thu Jul 13 21:43:22 2017 -0700

    Unexpected exceptions during async tests deadlocked
    
    When an asynchrously ran test raised a non-assertion exception the subsiquent
    recv call on the pipe would never complete...
    
      https://trac.torproject.org/projects/tor/ticket/22902
---
 stem/util/test_tools.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/stem/util/test_tools.py b/stem/util/test_tools.py
index cab96e5..3094f5c 100644
--- a/stem/util/test_tools.py
+++ b/stem/util/test_tools.py
@@ -33,8 +33,9 @@ import linecache
 import multiprocessing
 import os
 import re
-import time
 import threading
+import time
+import traceback
 import unittest
 
 import stem.prereq
@@ -167,6 +168,8 @@ class AsyncTest(object):
         conn.send(AsyncResult('failure', str(exc)))
       except SkipTest as exc:
         conn.send(AsyncResult('skipped', str(exc)))
+      except:
+        conn.send(AsyncResult('error', traceback.format_exc()))
       finally:
         conn.close()
 
@@ -207,6 +210,8 @@ class AsyncTest(object):
 
       if test and self._result.type == 'failure':
         test.fail(self._result.msg)
+      elif test and self._result.type == 'error':
+        test.fail(self._result.msg)
       elif test and self._result.type == 'skipped':
         test.skipTest(self._result.msg)
 



More information about the tor-commits mailing list