Bug 1247833 - Display the class name in mozunit output. r=gps draft
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 12 Feb 2016 12:29:51 +0900
changeset 330627 52f43cf45849f7780f51a7d91d97e77481ad9a42
parent 330626 6f21334856639ffd4eea714b3ac401b72a1e8b29
child 514200 d8efd9b0b167fde06feb6e9c0229ea8e2d8a8c7d
push id10787
push userbmo:mh+mozilla@glandium.org
push dateFri, 12 Feb 2016 03:34:56 +0000
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)