[PATCH 5 of 5] py3: make test-commit-interactive.t byte-safe

Yuya Nishihara yuya at tcha.org
Sat Mar 10 06:28:07 EST 2018


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1520679407 -32400
#      Sat Mar 10 19:56:47 2018 +0900
# Node ID e287b170d17027721fa7afee87ad6bce248f0660
# Parent  a984ebd44ac74e7b532963a50e0714d93e4465e3
py3: make test-commit-interactive.t byte-safe

diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist
--- a/contrib/python3-whitelist
+++ b/contrib/python3-whitelist
@@ -50,6 +50,7 @@ test-clone-r.t
 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
diff --git a/tests/test-commit-interactive.t b/tests/test-commit-interactive.t
--- a/tests/test-commit-interactive.t
+++ b/tests/test-commit-interactive.t
@@ -898,15 +898,18 @@ This tests that translated help message 
 
   $ 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 - '


More information about the Mercurial-devel mailing list