Commits

Michael Foord  committed c466546

Modify runner to use message rather than writing to stream directly

  • Participants
  • Parent commits 28ff2fb
  • Branches plugins

Comments (0)

Files changed (1)

File unittest2/runner.py

             hooks.stopTestRun(event)
 
         if hasattr(result, 'separator2'):
-            self.stream.writeln(result.separator2)
+            self.message(result.separator2, (0, 1, 2))
+            self.message('\n')
         run = result.testsRun
-        self.stream.writeln("Ran %d test%s in %.3fs" %
+        msg = ("Ran %d test%s in %.3fs\n\n" %
                             (run, run != 1 and "s" or "", timeTaken))
-        self.stream.writeln()
+        self.message(msg, (0, 1, 2))
         
         expectedFails = unexpectedSuccesses = skipped = 0
         try:
             pass
         infos = []
         if not result.wasSuccessful():
-            self.stream.write("FAILED")
+            self.message("FAILED", (0, 1, 2))
             failed, errored = map(len, (result.failures, result.errors))
             if failed:
                 infos.append("failures=%d" % failed)
             if errored:
                 infos.append("errors=%d" % errored)
         else:
-            self.stream.write("OK")
+            self.message("OK", (0, 1, 2))
         if skipped:
             infos.append("skipped=%d" % skipped)
         if expectedFails:
         if unexpectedSuccesses:
             infos.append("unexpected successes=%d" % unexpectedSuccesses)
         if infos:
-            self.stream.writeln(" (%s)" % (", ".join(infos),))
-        else:
-            self.stream.write("\n")
+            self.message(" (%s)" % (", ".join(infos),), (0, 1, 2))
+
+        self.message("\n")
         return result