# HG changeset patch # User Gregory Szorc # Date 1585517519 25200 # Node ID 47e6ec977555b0b1746c303a5e651458ce79a458 # Parent d359f0d1a3d37cea2dc64c62606df4393dd9afe4 tests: prevent printing \r to stdout Like we've done in other recent commits, we need to change sys.stdout on Python 3 to not use os.linesep so output is consistent on Python 3 on Windows. With this change, test-notify.t now passes on Python 3 on Windows! Differential Revision: https://phab.mercurial-scm.org/D8342 diff -r d359f0d1a3d3 -r 47e6ec977555 tests/test-notify.t --- a/tests/test-notify.t Sun Mar 29 13:51:26 2020 -0700 +++ b/tests/test-notify.t Sun Mar 29 14:31:59 2020 -0700 @@ -1,7 +1,16 @@ $ cat > $TESTTMP/filter.py < from __future__ import absolute_import, print_function + > import io > import re > import sys + > if sys.version_info[0] >= 3: + > sys.stdout = io.TextIOWrapper( + > sys.stdout.buffer, + > sys.stdout.encoding, + > sys.stdout.errors, + > newline="\n", + > line_buffering=sys.stdout.line_buffering, + > ) > print(re.sub("\n[ \t]", " ", sys.stdin.read()), end="") > EOF