changeset 36839:5b9ae9eca94a

py3: make test-commit-interactive.t byte-safe
author Yuya Nishihara <yuya@tcha.org>
date Sat, 10 Mar 2018 19:56:47 +0900
parents c268ba15deb3
children ef68493d652b
files contrib/python3-whitelist tests/test-commit-interactive.t
diffstat 2 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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 - '