# HG changeset patch # User Matt Harbison # Date 2024-10-15 22:35:45 # Node ID dbd2d56224d12e844da16d12176518f8600b43b3 # Parent e2311951b63a07c2bcfb104734e1b4244cc9826e tests: force `dummysmtpd.py` to write its log file with '\n' on Windows The log files were being `cat'd` in `test-patchbomb-tls.t`, and causing gratuitous failures. Since `sys.stdout` is being written to with `str` instead of `bytes`, use a `io.TextIOWrapper` to change the EOL, like 2924676d4728. diff --git a/tests/dummysmtpd.py b/tests/dummysmtpd.py --- a/tests/dummysmtpd.py +++ b/tests/dummysmtpd.py @@ -3,6 +3,7 @@ """dummy SMTP server for use in tests""" +import io import optparse import os import socket @@ -16,6 +17,13 @@ from mercurial import ( ui as uimod, ) +if pycompat.iswindows: + sys.stdout = io.TextIOWrapper( + sys.stdout.buffer, + sys.stdout.encoding, + sys.stdout.errors, + newline="\n", + ) if os.environ.get('HGIPV6', '0') == '1': family = socket.AF_INET6