Read about our upcoming Code of Conduct on this issue

This instance will be upgraded to Heptapod 0.28.1 on 2022-01-26 at 16:00 UTC+1 (a few minutes of down time)

Commit d7799390 authored by Gregory Szorc's avatar Gregory Szorc
Browse files

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
parent 02fa5392bab6
......@@ -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:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment