tests: force \n newlines when writing to sys.stdout
Without this, Python 3 on Windows inserts some \r that aren't
present in the input, causing test-http-bad-server.t to fail.
After this change, the test passes on Python 3 on Windows!
Differential Revision: https://phab.mercurial-scm.org/D8341
--- a/tests/filtertraceback.py Sun Mar 29 13:06:59 2020 -0700
+++ b/tests/filtertraceback.py Sun Mar 29 13:51:26 2020 -0700
@@ -4,8 +4,19 @@
from __future__ import absolute_import, print_function
+import io
import sys
+if sys.version_info[0] >= 3:
+ # Prevent \r from being inserted on Windows.
+ sys.stdout = io.TextIOWrapper(
+ sys.stdout.buffer,
+ sys.stdout.encoding,
+ sys.stdout.errors,
+ newline="\n",
+ line_buffering=sys.stdout.line_buffering,
+ )
+
state = 'none'
for line in sys.stdin: