changeset 36693:19e859cad54c

tests: port test-log to Python 3 Required some porting to >>> inline Python instead of using heredocs into $PYTHON. Differential Revision: https://phab.mercurial-scm.org/D2621
author Augie Fackler <augie@google.com>
date Sat, 03 Mar 2018 18:33:10 -0500
parents aeaf9c7f7528
children 1d06407d0ee9
files contrib/python3-whitelist tests/test-log.t
diffstat 2 files changed, 26 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/python3-whitelist	Sat Mar 03 19:12:47 2018 -0500
+++ b/contrib/python3-whitelist	Sat Mar 03 18:33:10 2018 -0500
@@ -172,6 +172,7 @@
 test-largefiles-small-disk.t
 test-locate.t
 test-lock-badness.t
+test-log.t
 test-logexchange.t
 test-lrucachedict.py
 test-mactext.t
--- a/tests/test-log.t	Sat Mar 03 19:12:47 2018 -0500
+++ b/tests/test-log.t	Sat Mar 03 18:33:10 2018 -0500
@@ -2016,33 +2016,31 @@
   $ hg init problematicencoding
   $ cd problematicencoding
 
-  $ $PYTHON > setup.sh <<EOF
-  > print(u'''
-  > echo a > text
-  > hg add text
-  > hg --encoding utf-8 commit -u '\u30A2' -m none
-  > echo b > text
-  > hg --encoding utf-8 commit -u '\u30C2' -m none
-  > echo c > text
-  > hg --encoding utf-8 commit -u none -m '\u30A2'
-  > echo d > text
-  > hg --encoding utf-8 commit -u none -m '\u30C2'
-  > '''.encode('utf-8'))
-  > EOF
+  >>> with open('setup.sh', 'wb') as f:
+  ...     f.write(u'''
+  ... echo a > text
+  ... hg add text
+  ... hg --encoding utf-8 commit -u '\u30A2' -m none
+  ... echo b > text
+  ... hg --encoding utf-8 commit -u '\u30C2' -m none
+  ... echo c > text
+  ... hg --encoding utf-8 commit -u none -m '\u30A2'
+  ... echo d > text
+  ... hg --encoding utf-8 commit -u none -m '\u30C2'
+  ... '''.encode('utf-8')) and None
   $ sh < setup.sh
 
 test in problematic encoding
-  $ $PYTHON > test.sh <<EOF
-  > print(u'''
-  > hg --encoding cp932 log --template '{rev}\\n' -u '\u30A2'
-  > echo ====
-  > hg --encoding cp932 log --template '{rev}\\n' -u '\u30C2'
-  > echo ====
-  > hg --encoding cp932 log --template '{rev}\\n' -k '\u30A2'
-  > echo ====
-  > hg --encoding cp932 log --template '{rev}\\n' -k '\u30C2'
-  > '''.encode('cp932'))
-  > EOF
+  >>> with open('test.sh', 'wb') as f:
+  ...     f.write(u'''
+  ... hg --encoding cp932 log --template '{rev}\\n' -u '\u30A2'
+  ... echo ====
+  ... hg --encoding cp932 log --template '{rev}\\n' -u '\u30C2'
+  ... echo ====
+  ... hg --encoding cp932 log --template '{rev}\\n' -k '\u30A2'
+  ... echo ====
+  ... hg --encoding cp932 log --template '{rev}\\n' -k '\u30C2'
+  ... '''.encode('cp932')) and None
   $ sh < test.sh
   0
   ====
@@ -2255,14 +2253,14 @@
   > from mercurial import namespaces
   > 
   > def reposetup(ui, repo):
-  >     foo = {'foo': repo[0].node()}
+  >     foo = {b'foo': repo[0].node()}
   >     names = lambda r: foo.keys()
   >     namemap = lambda r, name: foo.get(name)
   >     nodemap = lambda r, node: [name for name, n in foo.items()
   >                                if n == node]
   >     ns = namespaces.namespace(
-  >         "bars", templatename="bar", logname="barlog",
-  >         colorname="barcolor", listnames=names, namemap=namemap,
+  >         b"bars", templatename=b"bar", logname=b"barlog",
+  >         colorname=b"barcolor", listnames=names, namemap=namemap,
   >         nodemap=nodemap)
   > 
   >     repo.names.addnamespace(ns)