Bug 1272315: mozunit: log error message with line number only if available; r=glandium
authorDustin J. Mitchell <dustin@mozilla.com>
Tue, 24 May 2016 15:32:39 +0000
changeset 298848 cf196c79e5e5b22c35957c08e6d0b3d6fbc2b0e2
parent 298847 b306ec471adff16c34c07bfaa322168943031acd
child 298849 8fe22dd4fc8a753f9b4c479b773af8ce03f4dae7
push id30285
push usercbook@mozilla.com
push dateWed, 25 May 2016 13:06:07 +0000
treeherdermozilla-central@d6d4e8417d2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1272315
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1272315: mozunit: log error message with line number only if available; r=glandium MozReview-Commit-ID: 7Ye9RrKw6cw
config/mozunit.py
--- a/config/mozunit.py
+++ b/config/mozunit.py
@@ -68,24 +68,24 @@ class _MozTestResult(_TestResult):
     def addFailure(self, test, err):
         _TestResult.addFailure(self, test, err)
         self.printFail(test,err)
         self.stream.writeln("FAIL: {0}".format(self.getDescription(test)))
         self.stream.writeln(self.failures[-1][1])
 
     def printFail(self, test, err):
         exctype, value, tb = err
+        message = value.message.splitlines()[0]
         # Skip test runner traceback levels
         while tb and self._is_relevant_tb_level(tb):
             tb = tb.tb_next
-        if not tb:
-            self.stream.writeln("TEST-UNEXPECTED-FAIL | NO TRACEBACK |")
-        _f, _ln, _t = inspect.getframeinfo(tb)[:3]
-        self.printStatus('TEST-UNEXPECTED-FAIL', test,
-                         'line {0}: {1}'.format(_ln, value.message))
+        if tb:
+            _, ln, _ = inspect.getframeinfo(tb)[:3]
+            message = 'line {0}: {1}'.format(ln, message)
+        self.printStatus("TEST-UNEXPECTED-FAIL", test, message)
 
 
 class MozTestRunner(_TestRunner):
     def _makeResult(self):
         return _MozTestResult(self.stream, self.descriptions)
     def run(self, test):
         result = self._makeResult()
         test(result)