py3: make test-commit-interactive.t byte-safe
authorYuya Nishihara <yuya@tcha.org>
Sat, 10 Mar 2018 19:56:47 +0900
changeset 36839 5b9ae9eca94a
parent 36838 c268ba15deb3
child 36840 ef68493d652b
py3: make test-commit-interactive.t byte-safe
contrib/python3-whitelist
tests/test-commit-interactive.t
--- a/contrib/python3-whitelist	Sat Mar 10 19:49:09 2018 +0900
+++ b/contrib/python3-whitelist	Sat Mar 10 19:56:47 2018 +0900
@@ -50,6 +50,7 @@
 test-clone-update-order.t
 test-command-template.t
 test-commit-amend.t
+test-commit-interactive.t
 test-commit-multiple.t
 test-commit-unresolved.t
 test-commit.t
--- a/tests/test-commit-interactive.t	Sat Mar 10 19:49:09 2018 +0900
+++ b/tests/test-commit-interactive.t	Sat Mar 10 19:56:47 2018 +0900
@@ -898,15 +898,18 @@
 
   $ cat > $TESTTMP/escape.py <<EOF
   > from __future__ import absolute_import
-  > import sys
+  > from mercurial import (
+  >     pycompat,
+  >     util,
+  > )
   > def escape(c):
   >     o = ord(c)
   >     if o < 0x80:
   >         return c
   >     else:
-  >         return r'\x%02x' % o # escape char setting MSB
-  > for l in sys.stdin:
-  >     sys.stdout.write(''.join(escape(c) for c in l))
+  >         return br'\x%02x' % o # escape char setting MSB
+  > for l in util.stdin:
+  >     util.stdout.write(b''.join(escape(c) for c in pycompat.iterbytestr(l)))
   > EOF
 
   $ hg commit -i --encoding cp932 2>&1 <<EOF | $PYTHON $TESTTMP/escape.py | grep '^y - '