<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 8, 2015 at 8:15 AM, Jose Fonseca <span dir="ltr"><<a href="mailto:jfonseca@vmware.com" target="_blank">jfonseca@vmware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class=""><div class="h5">On 08/12/15 15:42, Dylan Baker wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
On Tue, Dec 08, 2015 at 01:23:29PM +0000, Jose Fonseca wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Exceptions were not reaching neither.<br>
<br>
Junit is probably still busted. But the right fix is to not catch<br>
generic Python exceptions, at all.<br>
---<br>
framework/results.py | 3 ++-<br>
framework/test/base.py | 7 ++++---<br>
templates/test_result.mako | 8 ++++++++<br>
3 files changed, 14 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/framework/results.py b/framework/results.py<br>
index eeffcb7..ef19fd4 100644<br>
--- a/framework/results.py<br>
+++ b/framework/results.py<br>
@@ -196,6 +196,7 @@ class TestResult(object):<br>
'subtests': self.subtests,<br>
'time': self.time,<br>
'exception': self.exception,<br>
+ 'traceback': self.traceback,<br>
'dmesg': self.dmesg,<br>
}<br>
return obj<br>
@@ -215,7 +216,7 @@ class TestResult(object):<br>
# pylint: disable=assigning-non-slot<br>
inst = cls()<br>
<br>
- for each in ['returncode', 'command', 'exception', 'environment',<br>
+ for each in ['returncode', 'command', 'exception', 'traceback', 'environment',<br>
'time', 'result', 'dmesg']:<br>
if each in dict_:<br>
setattr(inst, each, dict_[each])<br>
diff --git a/framework/test/base.py b/framework/test/base.py<br>
index bf998d8..ecd8bd9 100644<br>
--- a/framework/test/base.py<br>
+++ b/framework/test/base.py<br>
@@ -184,11 +184,12 @@ class Test(object):<br>
# This is a rare case where a bare exception is okay, since we're<br>
# using it to log exceptions<br>
except:<br>
- exception = sys.exc_info()<br>
+ exc_type, exc_value, exc_traceback = sys.exc_info()<br>
+ traceback.print_exc(file=sysstderr)<br>
</blockquote>
<br>
typo: sys.stderr<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
self.result.result = 'fail'<br>
- self.result.exception = "{}{}".format(*exception[:2])<br>
+ self.result.exception = "{}{}".format(exc_type, exc_value)<br>
self.result.traceback = "".join(<br>
- traceback.format_tb(exception[2]))<br>
+ traceback.format_tb(exc_traceback))<br>
<br>
log.log(self.result.result)<br>
else:<br>
diff --git a/templates/test_result.mako b/templates/test_result.mako<br>
index 229a5a7..ff08797 100644<br>
--- a/templates/test_result.mako<br>
+++ b/templates/test_result.mako<br>
@@ -75,6 +75,14 @@<br>
</pre>${value.command}</pre><br>
</td><br>
</tr><br>
+ % if value.exception:<br>
+ <tr><br>
+ <td>Exception</td><br>
+ <td><br>
+ <pre>${value.exception | h}</pre><br>
+ </td><br>
+ </tr><br>
+ % endif<br>
% if value.traceback:<br>
<tr><br>
<td>Traceback</td><br>
--<br>
2.5.0<br>
<br>
</blockquote>
This patch conflates two different issues. one is that you want the<br>
error printed,<br>
</blockquote>
<br></div></div>
Split now.<span class=""><br></span></blockquote><div><br>Then you can add my r-b to both. I like your version better than mine,
since you added the html summary data and I didn't. I'll pull the unit
test changes out of mine and push them later, since I think I'm the only
one who cares about those anyway.<br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="">
<br>
> one is that it needs to be stored in the json and<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
presented in the html summary. I'd prefer to see that as two separate<br>
changes.<br>
<br>
You said in a previous version that you wanted the suite to stop if you<br>
hit this issue, I sent a patch to do that.<br>
</blockquote>
<br></span>
I didn't notice. I wasn't CC'ed.<span class=""><font color="#888888"><br>
<br>
Jose</font></span></blockquote><div> <br>Ah, I apologize. I thought I'd CC'd you.<br><br></div><div>Sorry for the double message, I forgot to add the list last time.<span class="im"></span></div><div> </div></div><br></div></div>