Log AttributeError as 'info' instead of 'exception'
When failure happens in setUpClass, tearDownclass is being called
from base class irrespective of safe_setup decorator used or not in
specific test class. Which results to lot of instance of AttributeError
raised from tearDownclass. For example when tests case is skipped.
This patch provides a workaround by logging AttributeError as 'info'
instead of 'exception'.
Permanent fix for cleaning up those in more appropriate way will
be by split-up resource_setup & resource_cleanup in more structural way
as part of second phase of resource cleanup BP.
Change-Id: Ia49c9e171338e22f8d605fc53d251ef3d3471bb1
diff --git a/tempest/test.py b/tempest/test.py
index 4a22b1b..178ca10 100644
--- a/tempest/test.py
+++ b/tempest/test.py
@@ -299,7 +299,14 @@
try:
cls.tearDownClass()
except Exception as te:
- LOG.exception("tearDownClass failed: %s" % te)
+ tetype, _, _ = sys.exc_info()
+ # TODO(gmann): Till we split-up resource_setup &
+ # resource_cleanup in more structural way, log
+ # AttributeError as info instead of exception.
+ if tetype is AttributeError:
+ LOG.info("tearDownClass failed: %s" % te)
+ else:
+ LOG.exception("tearDownClass failed: %s" % te)
try:
raise etype(value), None, trace
finally: