changeset 36970:e55d80804ace

py3: make test-template-engine.t bytes-safe
author Yuya Nishihara <yuya@tcha.org>
date Fri, 16 Mar 2018 23:59:13 +0900
parents 452696bf3e60
children ff9cb7067329
files contrib/python3-whitelist tests/test-template-engine.t
diffstat 2 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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