[PATCH 1 of 4] run-tests: include "\n" in formatted message instead of calling writeln()

Yuya Nishihara yuya at tcha.org
Thu Aug 24 15:20:40 UTC 2017


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1503580197 -32400
#      Thu Aug 24 22:09:57 2017 +0900
# Node ID f22153763155ce72938f11beed25db352b923ff2
# Parent  10f1809ab98f18e7ad3284fcf5d3ec9b699c6e15
run-tests: include "\n" in formatted message instead of calling writeln()

So we don't have to strip "\n" from pygments output.

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -2043,21 +2043,21 @@ class TextTestRunner(unittest.TextTestRu
 
             if not self._runner.options.noskips:
                 for test, msg in result.skipped:
-                    formatted = 'Skipped %s: %s' % (test.name, msg)
+                    formatted = 'Skipped %s: %s\n' % (test.name, msg)
                     if result.color:
                         formatted = pygments.highlight(
                             formatted,
                             runnerlexer,
-                            runnerformatter).strip("\n")
-                    self.stream.writeln(formatted)
+                            runnerformatter)
+                    self.stream.write(formatted)
             for test, msg in result.failures:
-                formatted = 'Failed %s: %s' % (test.name, msg)
+                formatted = 'Failed %s: %s\n' % (test.name, msg)
                 if result.color:
                     formatted = pygments.highlight(
                         formatted,
                         runnerlexer,
-                        runnerformatter).strip("\n")
-                self.stream.writeln(formatted)
+                        runnerformatter)
+                self.stream.write(formatted)
             for test, msg in result.errors:
                 self.stream.writeln('Errored %s: %s' % (test.name, msg))
 


More information about the Mercurial-devel mailing list