[Neo-report] r2528 vincent - /trunk/neo/tests/functional/__init__.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Dec 13 21:07:30 CET 2010


Author: vincent
Date: Mon Dec 13 21:07:30 2010
New Revision: 2528

Log:
Make runWithTimeout re-raise exception which interrupted test method.

Modified:
    trunk/neo/tests/functional/__init__.py

Modified: trunk/neo/tests/functional/__init__.py
==============================================================================
--- trunk/neo/tests/functional/__init__.py [iso-8859-1] (original)
+++ trunk/neo/tests/functional/__init__.py [iso-8859-1] Mon Dec 13 21:07:30 2010
@@ -576,9 +576,19 @@ class NEOFunctionalTest(NeoTestBase):
     def runWithTimeout(self, timeout, method, args=(), kwargs=None):
         if kwargs is None:
             kwargs = {}
-        thread = threading.Thread(None, method, args=args, kwargs=kwargs)
+        exc_list = []
+        def excWrapper(*args, **kw):
+            try:
+                method(*args, **kw)
+            except:
+                exc_list.append(sys.exc_info())
+        thread = threading.Thread(None, excWrapper, args=args, kwargs=kwargs)
         thread.setDaemon(True)
         thread.start()
         thread.join(timeout)
         self.assertFalse(thread.isAlive(), 'Run timeout')
+        if exc_list:
+            assert len(exc_list) == 1, exc_list
+            exc = exc_list[0]
+            raise exc[0], exc[1], exc[2]
 




More information about the Neo-report mailing list