Patchwork D3363: tests: port inline extensions in test-hook.t to py3

login
register
mail settings
Submitter phabricator
Date April 16, 2018, 11:22 p.m.
Message ID <17dac6d9f2ee8f9d47f7dcc39d174f59@localhost.localdomain>
Download mbox | patch
Permalink /patch/31147/
State Not Applicable
Headers show

Comments

phabricator - April 16, 2018, 11:22 p.m.
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




To: durin42, #hg-reviewers, indygreg
Cc: mercurial-devel

Patch

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