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

login
register
mail settings
Submitter Yuya Nishihara
Date Aug. 24, 2017, 3:20 p.m.
Message ID <f22153763155ce72938f.1503588040@mimosa>
Download mbox | patch
Permalink /patch/23302/
State Accepted
Headers show

Comments

Yuya Nishihara - Aug. 24, 2017, 3:20 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@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.

Patch

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))