changeset 41000:b6c610bf567e

py3: use bytes stdout in test-check-help.t Setting stdout to binary seemed to have no effect on Windows, as it was appending a literal '\r' to each topic keyword. This also stops prepending 'b' to the topic on all platforms as well.
author Matt Harbison <matt_harbison@yahoo.com>
date Tue, 18 Dec 2018 14:01:06 -0500
parents dcac24ec935b
children c83ce53959ca
files tests/test-check-help.t
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-check-help.t	Wed Oct 31 22:43:08 2018 +0900
+++ b/tests/test-check-help.t	Tue Dec 18 14:01:06 2018 -0500
@@ -10,13 +10,14 @@
   >     import msvcrt
   >     import os
   >     msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
+  > stdout = getattr(sys.stdout, 'buffer', sys.stdout)
   > topics = set()
   > topicre = re.compile(br':hg:`help ([a-z0-9\-.]+)`')
   > for fname in sys.argv:
   >     with open(fname, 'rb') as f:
   >         topics.update(m.group(1) for m in topicre.finditer(f.read()))
   > for s in sorted(topics):
-  >     print(s)
+  >     stdout.write(b'%s\n' % s)
   > EOF
 
   $ cd "$TESTDIR"/..