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.
--- 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)