D3363: tests: port inline extensions in test-hook.t to py3
durin42 (Augie Fackler)
phabricator at mercurial-scm.org
Sat Apr 14 04:33:01 UTC 2018
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
This test *almost* passes now, but some import errors print very
differently in ways that seem at least somewhat important.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D3363
AFFECTED FILES
tests/test-hook.t
CHANGE DETAILS
diff --git a/tests/test-hook.t b/tests/test-hook.t
--- a/tests/test-hook.t
+++ b/tests/test-hook.t
@@ -3,8 +3,11 @@
$ cat > $TESTTMP/txnabort.checkargs.py <<EOF
+ > from mercurial import pycompat
> def showargs(ui, repo, hooktype, **kwargs):
- > ui.write('%s Python hook: %s\n' % (hooktype, ','.join(sorted(kwargs))))
+ > kwargs = pycompat.byteskwargs(kwargs)
+ > ui.write(b'%s Python hook: %s\n' % (hooktype,
+ > b','.join(sorted(kwargs))))
> EOF
$ hg init a
@@ -410,12 +413,15 @@
$ cat > hooktests.py <<EOF
> from __future__ import print_function
- > from mercurial import error
+ > from mercurial import (
+ > error,
+ > pycompat,
+ > )
>
> uncallable = 0
>
> def printargs(ui, args):
- > a = list(args.items())
+ > a = list(pycompat.byteskwargs(args).items())
> a.sort()
> ui.write(b'hook args:\n')
> for k, v in a:
@@ -432,7 +438,7 @@
> pass
>
> def raisehook(**args):
- > raise LocalException(b'exception from hook')
+ > raise LocalException('exception from hook')
>
> def aborthook(**args):
> raise error.Abort(b'raise abort from hook')
@@ -630,10 +636,10 @@
$ cat > hookext.py <<EOF
> def autohook(ui, **args):
- > ui.write('Automatically installed hook\n')
+ > ui.write(b'Automatically installed hook\n')
>
> def reposetup(ui, repo):
- > repo.ui.setconfig("hooks", "commit.auto", autohook)
+ > repo.ui.setconfig(b"hooks", b"commit.auto", autohook)
> EOF
$ echo '[extensions]' >> .hg/hgrc
$ echo 'hookext = hookext.py' >> .hg/hgrc
To: durin42, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list