py3: make test-template-engine.t bytes-safe
authorYuya Nishihara <yuya@tcha.org>
Fri, 16 Mar 2018 23:59:13 +0900
changeset 36970 e55d80804ace
parent 36969 452696bf3e60
child 36971 ff9cb7067329
py3: make test-template-engine.t bytes-safe
contrib/python3-whitelist
tests/test-template-engine.t
--- a/contrib/python3-whitelist	Thu Mar 15 20:10:54 2018 +0900
+++ b/contrib/python3-whitelist	Fri Mar 16 23:59:13 2018 +0900
@@ -388,6 +388,7 @@
 test-symlinks.t
 test-tag.t
 test-tags.t
+test-template-engine.t
 test-treemanifest.t
 test-unamend.t
 test-uncommit.t
--- a/tests/test-template-engine.t	Thu Mar 15 20:10:54 2018 +0900
+++ b/tests/test-template-engine.t	Fri Mar 16 23:59:13 2018 +0900
@@ -2,6 +2,7 @@
   $ cat > engine.py << EOF
   > 
   > from mercurial import (
+  >     pycompat,
   >     templater,
   >     templateutil,
   > )
@@ -15,19 +16,20 @@
   >         props = self._defaults.copy()
   >         props.update(map)
   >         for k, v in props.items():
-  >             if k in ('templ', 'ctx', 'repo', 'revcache', 'cache', 'troubles'):
+  >             if k in (b'templ', b'ctx', b'repo', b'revcache', b'cache',
+  >                      b'troubles'):
   >                 continue
   >             if callable(v) and getattr(v, '_requires', None) is None:
   >                 props = self._resources.copy()
   >                 props.update(map)
-  >                 v = v(**props)
+  >                 v = v(**pycompat.strkwargs(props))
   >             elif callable(v):
   >                 v = v(self, props)
   >             v = templateutil.stringify(v)
-  >             tmpl = tmpl.replace('{{%s}}' % k, v)
+  >             tmpl = tmpl.replace(b'{{%s}}' % k, v)
   >         yield tmpl
   > 
-  > templater.engines['my'] = mytemplater
+  > templater.engines[b'my'] = mytemplater
   > EOF
   $ hg init test
   $ echo '[extensions]' > test/.hg/hgrc