D3363: tests: port inline extensions in test-hook.t to py3
durin42 (Augie Fackler)
phabricator at mercurial-scm.org
Mon Apr 16 19:22:44 EDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG9bbb13c0f982: tests: port inline extensions in test-hook.t to py3 (authored by durin42, committed by ).
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D3363?vs=8240&id=8357
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, indygreg
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list