changeset 52093:dbd2d56224d1

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.
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 15 Oct 2024 18:35:45 -0400
parents e2311951b63a
children 87faafd6ea83
files tests/dummysmtpd.py
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/dummysmtpd.py	Mon Oct 14 20:11:27 2024 -0400
+++ b/tests/dummysmtpd.py	Tue Oct 15 18:35:45 2024 -0400
@@ -3,6 +3,7 @@
 """dummy SMTP server for use in tests"""
 
 
+import io
 import optparse
 import os
 import socket
@@ -16,6 +17,13 @@
     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