Bug 1247833 - Display the class name in mozunit output. r=gps
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 12 Feb 2016 12:29:51 +0900
changeset 284421 17132c8ff5f4b67b319478899a8e0763448337e1
parent 284420 199a9500951dc2d14329b95ff7265aa5712cf966
child 284422 90cf17107095730ad9e836b49f62b73bbc28644c
push idunknown
push userunknown
push dateunknown
reviewersgps
bugs1247833
milestone47.0a1
Bug 1247833 - Display the class name in mozunit output. r=gps One can run individual tests with python testfile.py Class.method. But the output for tests only shows the method so looking at a test output is not enough to tell how to run one particular test. Moreover, there are many cases where a test file contains multiple classes, and we fail to identify the difference between those classes.
config/mozunit.py
--- a/config/mozunit.py
+++ b/config/mozunit.py
@@ -28,19 +28,20 @@ class _MozTestResult(_TestResult):
 
     def getDescription(self, test):
         if self.descriptions:
             return test.shortDescription() or str(test)
         else:
             return str(test)
 
     def printStatus(self, status, test, message=''):
-        line = "{status} | {file} | {test}{sep}{message}".format(
+        line = "{status} | {file} | {klass}.{test}{sep}{message}".format(
             status=status,
             file=inspect.getfile(test.__class__),
+            klass=test.__class__.__name__,
             test=test._testMethodName,
             sep=', ' if message else '',
             message=message,
         )
         self.stream.writeln(line)
 
     def addSuccess(self, test):
         _TestResult.addSuccess(self, test)