Moved unit test status to begin of line.

parent f3e2921d
...@@ -42,7 +42,21 @@ class TextTestRunner(unittest.TextTestRunner): ...@@ -42,7 +42,21 @@ class TextTestRunner(unittest.TextTestRunner):
timeTaken = stopTime - startTime timeTaken = stopTime - startTime
result.printErrors() result.printErrors()
self.stream.write('%s: %d test%s in %.3fs ' \ if not result.wasSuccessful():
if self.color:
msg = '\033[0;31mFAIL\033[1;m'
else:
msg = 'FAIL'
self.stream.write(msg)
else:
if self.color:
msg = '\033[0;32mOK\033[0;m'
else:
msg = 'OK'
self.stream.write(msg)
self.stream.write(' %s: %d test%s in %.3fs ' \
% (test.filename, result.testsRun, % (test.filename, result.testsRun,
result.testsRun != 1 and 's' or '', timeTaken)) result.testsRun != 1 and 's' or '', timeTaken))
...@@ -60,15 +74,9 @@ class TextTestRunner(unittest.TextTestRunner): ...@@ -60,15 +74,9 @@ class TextTestRunner(unittest.TextTestRunner):
infos = [] infos = []
if not result.wasSuccessful(): if not result.wasSuccessful():
if self.color:
msg = '\033[0;31mFAILED\033[1;m'
else:
msg = 'FAILED'
self.stream.write(msg)
failed, errored = map(len, (result.failures, result.errors)) failed, errored = map(len, (result.failures, result.errors))
if failed: if failed:
if self.color: if self.color:
msg = 'failures=\033[1;31m%d\033[1;m' msg = 'failures=\033[1;31m%d\033[1;m'
else: else:
...@@ -81,13 +89,6 @@ class TextTestRunner(unittest.TextTestRunner): ...@@ -81,13 +89,6 @@ class TextTestRunner(unittest.TextTestRunner):
else: else:
msg = 'errors=%d' msg = 'errors=%d'
infos.append(msg % errored) infos.append(msg % errored)
else:
if self.color:
msg = '\033[0;32mOK\033[0;m'
else:
msg = 'OK'
self.stream.write(msg)
if skipped: if skipped:
if self.color: if self.color:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment