# HG changeset patch # User Yuya Nishihara # Date 2018-03-16 14:59:13 # Node ID e55d80804ace79f93efa8f049665a72a1dafcd85 # Parent 452696bf3e606434d5c2d856988ef640643f1d28 py3: make test-template-engine.t bytes-safe diff --git a/contrib/python3-whitelist b/contrib/python3-whitelist --- a/contrib/python3-whitelist +++ b/contrib/python3-whitelist @@ -388,6 +388,7 @@ test-subrepo.t test-symlinks.t test-tag.t test-tags.t +test-template-engine.t test-treemanifest.t test-unamend.t test-uncommit.t diff --git a/tests/test-template-engine.t b/tests/test-template-engine.t --- a/tests/test-template-engine.t +++ b/tests/test-template-engine.t @@ -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