Mercurial > hg
changeset 52114:7332eae326de
tests: force `dumbhttp.py` to write its log file with '\n' on Windows
This wasn't causing obvious test failures, but it's the same fix as dbd2d56224d1
for `dummysmtpd.py`, and there's no sense in leaving this problem lying around.
(And upon further review, it might have been causing some non-obviously related
failures- see the next commit.)
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Thu, 17 Oct 2024 15:21:20 -0400 |
parents | b2e90465daf6 |
children | bf3e6680c3e4 |
files | tests/dumbhttp.py |
diffstat | 1 files changed, 15 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/dumbhttp.py Sat Oct 26 04:16:00 2024 +0200 +++ b/tests/dumbhttp.py Thu Oct 17 15:21:20 2024 -0400 @@ -5,6 +5,7 @@ Small and dumb HTTP server for use in tests. """ +import io import optparse import os import signal @@ -21,6 +22,20 @@ httpserver = util.httpserver OptionParser = optparse.OptionParser +if pycompat.iswindows: + sys.stdout = io.TextIOWrapper( + sys.stdout.buffer, + sys.stdout.encoding, + sys.stdout.errors, + newline="\n", + ) + sys.stderr = io.TextIOWrapper( + sys.stderr.buffer, + sys.stderr.encoding, + sys.stderr.errors, + newline="\n", + ) + if os.environ.get('HGIPV6', '0') == '1': class simplehttpserver(httpserver.httpserver):