Skip to content

Commit 476b2f0

Browse files
committed
adjust output to correspond to unittest
Generally speaking, expected occurrences are lowercase whereas anything exceptional and worthy of notice is uppercase. Examples of the former include tests passing, skips and expected failures; examples of the latter include failures, errors and unexpected successes.
1 parent 23f4038 commit 476b2f0

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

xmlrunner/result.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ def addSuccess(self, test):
313313
"""
314314
self._save_output_data()
315315
self._prepare_callback(
316-
self.infoclass(self, test), self.successes, 'OK', '.'
316+
self.infoclass(self, test), self.successes, 'ok', '.'
317317
)
318318

319319
@failfast
@@ -380,8 +380,10 @@ def addSkip(self, test, reason):
380380
self._save_output_data()
381381
testinfo = self.infoclass(
382382
self, test, self.infoclass.SKIP, reason)
383+
testinfo.test_exception_name = 'skip'
384+
testinfo.test_exception_message = reason
383385
self.skipped.append((testinfo, reason))
384-
self._prepare_callback(testinfo, [], 'SKIP', 'S')
386+
self._prepare_callback(testinfo, [], 'skip', 's')
385387

386388
def addExpectedFailure(self, test, err):
387389
"""
@@ -390,11 +392,11 @@ def addExpectedFailure(self, test, err):
390392
self._save_output_data()
391393

392394
testinfo = self.infoclass(self, test, self.infoclass.ERROR, err)
393-
testinfo.test_exception_name = 'ExpectedFailure'
394-
testinfo.test_exception_message = 'EXPECTED FAILURE: {}'.format(testinfo.test_exception_message)
395+
testinfo.test_exception_name = 'XFAIL'
396+
testinfo.test_exception_message = 'expected failure: {}'.format(testinfo.test_exception_message)
395397

396398
self.expectedFailures.append((testinfo, self._exc_info_to_string(err, test)))
397-
self._prepare_callback(testinfo, [], 'EXPECTED FAILURE', 'X')
399+
self._prepare_callback(testinfo, [], 'expected failure', 'x')
398400

399401
@failfast
400402
def addUnexpectedSuccess(self, test):
@@ -407,11 +409,11 @@ def addUnexpectedSuccess(self, test):
407409
testinfo.outcome = self.infoclass.ERROR
408410
# But since we want to have error outcome, we need to provide additional fields:
409411
testinfo.test_exception_name = 'UnexpectedSuccess'
410-
testinfo.test_exception_message = ('UNEXPECTED SUCCESS: This test was marked as expected failure but passed, '
412+
testinfo.test_exception_message = ('Unexpected success: This test was marked as expected failure but passed, '
411413
'please review it')
412414

413-
self.unexpectedSuccesses.append(testinfo)
414-
self._prepare_callback(testinfo, [], 'UNEXPECTED SUCCESS', 'U')
415+
self.unexpectedSuccesses.append((testinfo, 'unexpected success'))
416+
self._prepare_callback(testinfo, [], 'unexpected success', 'u')
415417

416418
def printErrorList(self, flavour, errors):
417419
"""

0 commit comments

Comments
 (0)