safe_setup preserve original trace
When safe_setup reraies the exception the traceback was
replaced by the trace of the re-raise postion.
This change is aiming to preserve the original stack trace,
by saving the original trace and raiseing new exception from the same
type with the original trace.
Change-Id: I16851a0c1d40d7f7253c23f066fa8c19267f4d9a
diff --git a/tempest/test.py b/tempest/test.py
index 8df405c..254fffa 100644
--- a/tempest/test.py
+++ b/tempest/test.py
@@ -75,12 +75,16 @@
try:
f(cls)
except Exception as se:
+ etype, value, trace = sys.exc_info()
LOG.exception("setUpClass failed: %s" % se)
try:
cls.tearDownClass()
except Exception as te:
LOG.exception("tearDownClass failed: %s" % te)
- raise se
+ try:
+ raise etype(value), None, trace
+ finally:
+ del trace # for avoiding circular refs
return decorator