[devtools] Properly reraise the exception
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 30 Sep 2016 17:03:33 +0200
changeset 11748 c6d37774f4d0
parent 11747 9a6a8a683728
child 11749 ae9789d77ea0
[devtools] Properly reraise the exception with previous implementation, the original exception wasn't visible in python 2.
cubicweb/devtools/testlib.py
--- a/cubicweb/devtools/testlib.py	Mon Oct 24 14:41:36 2016 +0200
+++ b/cubicweb/devtools/testlib.py	Fri Sep 30 17:03:33 2016 +0200
@@ -28,7 +28,7 @@
 from itertools import chain
 import tempfile
 
-from six import text_type, string_types
+from six import text_type, string_types, reraise
 from six.moves import range
 from six.moves.urllib.parse import urlparse, parse_qs, unquote as urlunquote
 
@@ -981,9 +981,7 @@
                 msg = '[%s in %s] %s' % (klass, view.__regid__, exc)
             except Exception:
                 msg = '[%s in %s] undisplayable exception' % (klass, view.__regid__)
-            exc = AssertionError(msg)
-            exc.__traceback__ = tcbk
-            raise exc
+            reraise(AssertionError, AssertionError(msg), sys.exc_info()[-1])
         return self._check_html(output, view, template)
 
     def get_validator(self, view=None, content_type=None, output=None):