tests: write directly to stdout to avoid b'' prefixes
authorGregory Szorc <gregory.szorc@gmail.com>
Wed, 23 Jan 2019 17:45:11 -0800
changeset 41329 84707d9e77a0
parent 41328 13ccb03f2145
child 41330 d5c58d679ed9
tests: write directly to stdout to avoid b'' prefixes This enables the test to pass on Python 3. Differential Revision: https://phab.mercurial-scm.org/D5668
tests/test-mq-eol.t
--- a/tests/test-mq-eol.t	Wed Jan 23 17:41:46 2019 -0800
+++ b/tests/test-mq-eol.t	Wed Jan 23 17:45:11 2019 -0800
@@ -30,10 +30,14 @@
 
   $ cat > cateol.py <<EOF
   > import sys
+  > try:
+  >     stdout = sys.stdout.buffer
+  > except AttributeError:
+  >     stdout = sys.stdout
   > for line in open(sys.argv[1], 'rb'):
   >     line = line.replace(b'\r', b'<CR>')
   >     line = line.replace(b'\n', b'<LF>')
-  >     print(line)
+  >     stdout.write(line + b'\n')
   > EOF
 
   $ hg init repo