Mercurial > hg
diff tests/test-bugzilla.t @ 41343:7370f302be71
py3: port test-bugzilla.t to Python 3
Some assorted fixes required in the extension itself, all around
bytes/str issues.
Differential Revision: https://phab.mercurial-scm.org/D5680
author | Augie Fackler <augie@google.com> |
---|---|
date | Thu, 24 Jan 2019 13:54:45 -0500 |
parents | fc3cca406b2e |
children | 42d2b31cee0b |
line wrap: on
line diff
--- a/tests/test-bugzilla.t Sun Jan 20 21:49:58 2019 -0800 +++ b/tests/test-bugzilla.t Thu Jan 24 13:54:45 2019 -0500 @@ -3,7 +3,9 @@ $ cat <<EOF > bzmock.py > from __future__ import absolute_import > from mercurial import extensions + > from mercurial import pycompat > from mercurial import registrar + > from mercurial.utils import stringutil > > configtable = {} > configitem = registrar.configitem(configtable) @@ -18,14 +20,17 @@ > super(bzmock, self).__init__(ui) > self._logfile = ui.config(b'bugzilla', b'mocklog') > def updatebug(self, bugid, newstate, text, committer): - > with open(self._logfile, 'a') as f: - > f.write('update bugid=%r, newstate=%r, committer=%r\n' - > % (bugid, newstate, committer)) - > f.write('----\n' + text + '\n----\n') + > with open(pycompat.fsdecode(self._logfile), 'ab') as f: + > f.write(b'update bugid=%s, newstate=%s, committer=%s\n' + > % (stringutil.pprint(bugid), + > stringutil.pprint(newstate), + > stringutil.pprint(committer))) + > f.write(b'----\n' + text + b'\n----\n') > def notify(self, bugs, committer): - > with open(self._logfile, 'a') as f: - > f.write('notify bugs=%r, committer=%r\n' - > % (bugs, committer)) + > with open(pycompat.fsdecode(self._logfile), 'ab') as f: + > f.write(b'notify bugs=%s, committer=%s\n' + > % (stringutil.pprint(bugs), + > stringutil.pprint(committer))) > bugzilla.bugzilla._versions[b'mock'] = bzmock > EOF