Michael Foord avatar Michael Foord committed c466546

Modify runner to use message rather than writing to stream directly

Comments (0)

Files changed (1)

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
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.