[PATCH] run-tests: print diff to stderr instead to stdout

Simon Heimberg simohe at besonet.ch
Mon Feb 10 07:27:00 CST 2014


# HG changeset patch
# User Simon Heimberg <simohe at besonet.ch>
# Date 1391878137 -3600
# Node ID 12df27e151f1d72a180ab1e40222a9d88110e096
# Parent  289c3b0e73da58ed81a0be54956034437572b98d
run-tests: print diff to stderr instead to stdout

On buildbot, this has the advantage that the diff output is colured red. This
visual structuring makes the result easier to read.

diff -r 289c3b0e73da -r 12df27e151f1 tests/run-tests.py
--- a/tests/run-tests.py	Sam Feb 08 10:41:17 2014 +0100
+++ b/tests/run-tests.py	Sam Feb 08 17:48:57 2014 +0100
@@ -299,9 +299,10 @@
     return missing, failed
 
 def showdiff(expected, output, ref, err):
-    print
+    sys.stderr.write('\n')
     for line in difflib.unified_diff(expected, output, ref, err):
-        sys.stdout.write(line)
+        sys.stderr.write(line)
+    sys.stderr.flush()
 
 verbose = False
 def vlog(*msg):


More information about the Mercurial-devel mailing list