py3: have test-revset2.t write test scripts in a more portable way
authorAugie Fackler <augie@google.com>
Thu, 24 Jan 2019 16:07:32 -0500
changeset 41477 4caf56c33009
parent 41476 fd2f1f0071b9
child 41478 8e0dd36f7a97
py3: have test-revset2.t write test scripts in a more portable way Fixes the test on Python 3. Differential Revision: https://phab.mercurial-scm.org/D5763
contrib/python3-whitelist
tests/test-revset2.t
--- a/contrib/python3-whitelist	Wed Jan 30 16:43:52 2019 -0500
+++ b/contrib/python3-whitelist	Thu Jan 24 16:07:32 2019 -0500
@@ -630,6 +630,7 @@
 test-revset-dirstate-parents.t
 test-revset-legacy-lookup.t
 test-revset-outgoing.t
+test-revset2.t
 test-rollback.t
 test-run-tests.py
 test-run-tests.t
--- a/tests/test-revset2.t	Wed Jan 30 16:43:52 2019 -0500
+++ b/tests/test-revset2.t	Thu Jan 24 16:07:32 2019 -0500
@@ -1525,8 +1525,8 @@
   $ hg init problematicencoding
   $ cd problematicencoding
 
-  $ "$PYTHON" > setup.sh <<EOF
-  > print(u'''
+  $ "$PYTHON" <<EOF
+  > open('setup.sh', 'wb').write(u'''
   > echo a > text
   > hg add text
   > hg --encoding utf-8 commit -u '\u30A2' -m none
@@ -1541,8 +1541,8 @@
   $ sh < setup.sh
 
 test in problematic encoding
-  $ "$PYTHON" > test.sh <<EOF
-  > print(u'''
+  $ "$PYTHON" <<EOF
+  > open('test.sh', 'wb').write(u'''
   > hg --encoding cp932 log --template '{rev}\\n' -r 'author(\u30A2)'
   > echo ====
   > hg --encoding cp932 log --template '{rev}\\n' -r 'author(\u30C2)'