Patchwork [6,of,6] py3: make sure commands name are bytes in tests

login
register
mail settings
Submitter Pulkit Goyal
Date June 26, 2017, 1:24 p.m.
Message ID <36b24166a0312e315078.1498483487@workspace>
Download mbox | patch
Permalink /patch/21735/
State Accepted
Headers show

Comments

Pulkit Goyal - June 26, 2017, 1:24 p.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 1498359005 -19800
#      Sun Jun 25 08:20:05 2017 +0530
# Node ID 36b24166a0312e315078eed294d5e11949299bcf
# Parent  9b4f630d4488873d10af57cc28522655736df752
py3: make sure commands name are bytes in tests
Augie Fackler - June 26, 2017, 2:56 p.m.
On Mon, Jun 26, 2017 at 06:54:47PM +0530, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <7895pulkit@gmail.com>
> # Date 1498359005 -19800
> #      Sun Jun 25 08:20:05 2017 +0530
> # Node ID 36b24166a0312e315078eed294d5e11949299bcf
> # Parent  9b4f630d4488873d10af57cc28522655736df752
> py3: make sure commands name are bytes in tests

queued, thanks

Patch

diff --git a/tests/test-bad-extension.t b/tests/test-bad-extension.t
--- a/tests/test-bad-extension.t
+++ b/tests/test-bad-extension.t
@@ -65,7 +65,7 @@ 
   > from mercurial import commands, extensions, registrar
   > cmdtable = {}
   > command = registrar.command(cmdtable)
-  > @command('showbadexts', norepo=True)
+  > @command(b'showbadexts', norepo=True)
   > def showbadexts(ui, *pats, **opts):
   >     ui.write('BADEXTS: %s\n' % ' '.join(sorted(extensions.notloaded())))
   > EOF
diff --git a/tests/test-bundle2-format.t b/tests/test-bundle2-format.t
--- a/tests/test-bundle2-format.t
+++ b/tests/test-bundle2-format.t
@@ -70,7 +70,7 @@ 
   >             for val in op.reply.capabilities[cap]:
   >                 op.ui.write('debugreply:         %r\n' % val)
   > 
-  > @command('bundle2',
+  > @command(b'bundle2',
   >          [('', 'param', [], 'stream level parameter'),
   >           ('', 'unknown', False, 'include an unknown mandatory part in the bundle'),
   >           ('', 'unknownparams', False, 'include an unknown part parameters in the bundle'),
@@ -169,7 +169,7 @@ 
   >     finally:
   >         file.flush()
   > 
-  > @command('unbundle2', [], '')
+  > @command(b'unbundle2', [], '')
   > def cmdunbundle2(ui, repo, replypath=None):
   >     """process a bundle2 stream from stdin on the current repo"""
   >     try:
@@ -200,7 +200,7 @@ 
   >             for chunk in op.reply.getchunks():
   >                 file.write(chunk)
   > 
-  > @command('statbundle2', [], '')
+  > @command(b'statbundle2', [], '')
   > def cmdstatbundle2(ui, repo):
   >     """print statistic on the bundle2 container read from stdin"""
   >     unbundler = bundle2.getunbundler(ui, sys.stdin)
diff --git a/tests/test-chg.t b/tests/test-chg.t
--- a/tests/test-chg.t
+++ b/tests/test-chg.t
@@ -108,7 +108,7 @@ 
   > from mercurial import registrar
   > cmdtable = {}
   > command = registrar.command(cmdtable)
-  > @command('crash')
+  > @command(b'crash')
   > def pagercrash(ui, repo, *pats, **opts):
   >     ui.write('going to crash\n')
   >     raise Exception('.')
diff --git a/tests/test-commandserver.t b/tests/test-commandserver.t
--- a/tests/test-commandserver.t
+++ b/tests/test-commandserver.t
@@ -575,16 +575,16 @@ 
   > from mercurial import commands, registrar
   > cmdtable = {}
   > command = registrar.command(cmdtable)
-  > @command("debuggetpass", norepo=True)
+  > @command(b"debuggetpass", norepo=True)
   > def debuggetpass(ui):
   >     ui.write("%s\\n" % ui.getpass())
-  > @command("debugprompt", norepo=True)
+  > @command(b"debugprompt", norepo=True)
   > def debugprompt(ui):
   >     ui.write("%s\\n" % ui.prompt("prompt:"))
-  > @command("debugreadstdin", norepo=True)
+  > @command(b"debugreadstdin", norepo=True)
   > def debugreadstdin(ui):
   >     ui.write("read: %r\n" % sys.stdin.read(1))
-  > @command("debugwritestdout", norepo=True)
+  > @command(b"debugwritestdout", norepo=True)
   > def debugwritestdout(ui):
   >     os.write(1, "low-level stdout fd and\n")
   >     sys.stdout.write("stdout should be redirected to /dev/null\n")
diff --git a/tests/test-devel-warnings.t b/tests/test-devel-warnings.t
--- a/tests/test-devel-warnings.t
+++ b/tests/test-devel-warnings.t
@@ -203,7 +203,7 @@ 
   > cmdtable = {}
   > command = registrar.command(cmdtable)
   > 
-  > @command('buggyconfig')
+  > @command(b'buggyconfig')
   > def cmdbuggyconfig(ui, repo):
   >     repo.ui.config('ui', 'quiet', False)
   >     repo.ui.config('ui', 'interactive', None)
diff --git a/tests/test-encoding-align.t b/tests/test-encoding-align.t
--- a/tests/test-encoding-align.t
+++ b/tests/test-encoding-align.t
@@ -20,7 +20,7 @@ 
   > cmdtable = {}
   > command = registrar.command(cmdtable)
   > 
-  > @command('showoptlist',
+  > @command(b'showoptlist',
   >     [('s', 'opt1', '', 'short width'  + ' %(s)s' * 8, '%(s)s'),
   >     ('m', 'opt2', '', 'middle width' + ' %(m)s' * 8, '%(m)s'),
   >     ('l', 'opt3', '', 'long width'   + ' %(l)s' * 8, '%(l)s')],
diff --git a/tests/test-encoding-textwrap.t b/tests/test-encoding-textwrap.t
--- a/tests/test-encoding-textwrap.t
+++ b/tests/test-encoding-textwrap.t
@@ -12,7 +12,7 @@ 
   > command = registrar.command(cmdtable)
   > 
   > # Japanese full-width characters:
-  > @command('show_full_ja', [], '')
+  > @command(b'show_full_ja', [], '')
   > def show_full_ja(ui, **opts):
   >     u'''\u3042\u3044\u3046\u3048\u304a\u304b\u304d\u304f\u3051 \u3042\u3044\u3046\u3048\u304a\u304b\u304d\u304f\u3051 \u3042\u3044\u3046\u3048\u304a\u304b\u304d\u304f\u3051
   > 
@@ -22,7 +22,7 @@ 
   >     '''
   > 
   > # Japanese half-width characters:
-  > @command('show_half_ja', [], '')
+  > @command(b'show_half_ja', [], '')
   > def show_half_ja(ui, *opts):
   >     u'''\uff71\uff72\uff73\uff74\uff75\uff76\uff77\uff78\uff79 \uff71\uff72\uff73\uff74\uff75\uff76\uff77\uff78\uff79 \uff71\uff72\uff73\uff74\uff75\uff76\uff77\uff78\uff79 \uff71\uff72\uff73\uff74\uff75\uff76\uff77\uff78\uff79
   > 
@@ -32,7 +32,7 @@ 
   >     '''
   > 
   > # Japanese ambiguous-width characters:
-  > @command('show_ambig_ja', [], '')
+  > @command(b'show_ambig_ja', [], '')
   > def show_ambig_ja(ui, **opts):
   >     u'''\u03b1\u03b2\u03b3\u03b4\u03c5\u03b6\u03b7\u03b8\u25cb \u03b1\u03b2\u03b3\u03b4\u03c5\u03b6\u03b7\u03b8\u25cb \u03b1\u03b2\u03b3\u03b4\u03c5\u03b6\u03b7\u03b8\u25cb
   > 
@@ -42,7 +42,7 @@ 
   >     '''
   > 
   > # Russian ambiguous-width characters:
-  > @command('show_ambig_ru', [], '')
+  > @command(b'show_ambig_ru', [], '')
   > def show_ambig_ru(ui, **opts):
   >     u'''\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438
   > 
diff --git a/tests/test-extension.t b/tests/test-extension.t
--- a/tests/test-extension.t
+++ b/tests/test-extension.t
@@ -12,10 +12,10 @@ 
   >     ui.write("reposetup called for %s\\n" % os.path.basename(repo.root))
   >     ui.write("ui %s= repo.ui\\n" % (ui == repo.ui and "=" or "!"))
   >     ui.flush()
-  > @command('foo', [], 'hg foo')
+  > @command(b'foo', [], 'hg foo')
   > def foo(ui, *args, **kwargs):
   >     ui.write("Foo\\n")
-  > @command('bar', [], 'hg bar', norepo=True)
+  > @command(b'bar', [], 'hg bar', norepo=True)
   > def bar(ui, *args, **kwargs):
   >     ui.write("Bar\\n")
   > EOF
@@ -408,12 +408,12 @@ 
   > # preceding import (= instantiate "demandmod" object instead of
   > # real "module" object) might hide problem of succeeding import.
   > 
-  > @command('showabsolute', [], norepo=True)
+  > @command(b'showabsolute', [], norepo=True)
   > def showabsolute(ui, *args, **opts):
   >     from absextroot import absolute
   >     ui.write('ABS: %s\n' % '\nABS: '.join(absolute.getresult()))
   > 
-  > @command('showrelative', [], norepo=True)
+  > @command(b'showrelative', [], norepo=True)
   > def showrelative(ui, *args, **opts):
   >     from . import relative
   >     ui.write('REL: %s\n' % '\nREL: '.join(relative.getresult()))
@@ -470,7 +470,7 @@ 
   > # demand import avoids failure of importing notexist here
   > import extlibroot.lsub1.lsub2.notexist
   > 
-  > @command('checkrelativity', [], norepo=True)
+  > @command(b'checkrelativity', [], norepo=True)
   > def checkrelativity(ui, *args, **opts):
   >     try:
   >         ui.write(extlibroot.lsub1.lsub2.notexist.text)
@@ -509,11 +509,11 @@ 
   > from mercurial import registrar
   > cmdtable = {}
   > command = registrar.command(cmdtable)
-  > @command('debugfoobar', [], 'hg debugfoobar')
+  > @command(b'debugfoobar', [], 'hg debugfoobar')
   > def debugfoobar(ui, repo, *args, **opts):
   >     "yet another debug command"
   >     pass
-  > @command('foo', [], 'hg foo')
+  > @command(b'foo', [], 'hg foo')
   > def foo(ui, repo, *args, **opts):
   >     """yet another foo command
   >     This command has been DEPRECATED since forever.
@@ -750,7 +750,7 @@ 
   > command = registrar.command(cmdtable)
   > """multirevs extension
   > Big multi-line module docstring."""
-  > @command('multirevs', [], 'ARG', norepo=True)
+  > @command(b'multirevs', [], 'ARG', norepo=True)
   > def multirevs(ui, repo, arg, *args, **opts):
   >     """multirevs command"""
   >     pass
@@ -825,11 +825,11 @@ 
   > from mercurial import commands, registrar
   > cmdtable = {}
   > command = registrar.command(cmdtable)
-  > @command('dodo', [], 'hg dodo')
+  > @command(b'dodo', [], 'hg dodo')
   > def dodo(ui, *args, **kwargs):
   >     """Does nothing"""
   >     ui.write("I do nothing. Yay\\n")
-  > @command('foofoo', [], 'hg foofoo')
+  > @command(b'foofoo', [], 'hg foofoo')
   > def foofoo(ui, *args, **kwargs):
   >     """Writes 'Foo foo'"""
   >     ui.write("Foo foo\\n")
@@ -936,11 +936,11 @@ 
   > from mercurial import commands, registrar
   > cmdtable = {}
   > command = registrar.command(cmdtable)
-  > @command('something', [], 'hg something')
+  > @command(b'something', [], 'hg something')
   > def something(ui, *args, **kwargs):
   >     """Does something"""
   >     ui.write("I do something. Yaaay\\n")
-  > @command('beep', [], 'hg beep')
+  > @command(b'beep', [], 'hg beep')
   > def beep(ui, *args, **kwargs):
   >     """Writes 'Beep beep'"""
   >     ui.write("Beep beep\\n")
@@ -1180,7 +1180,7 @@ 
   > cmdtable = {}
   > command = registrar.command(cmdtable)
   > class Bogon(Exception): pass
-  > @command('throw', [], 'hg throw', norepo=True)
+  > @command(b'throw', [], 'hg throw', norepo=True)
   > def throw(ui, **opts):
   >     """throws an exception"""
   >     raise Bogon()
@@ -1617,7 +1617,7 @@ 
   > from mercurial import cmdutil
   > cmdtable = {}
   > command = cmdutil.command(cmdtable)
-  > @command('foo', [], norepo=True)
+  > @command(b'foo', [], norepo=True)
   > def foo(ui):
   >     pass
   > EOF
diff --git a/tests/test-lock-badness.t b/tests/test-lock-badness.t
--- a/tests/test-lock-badness.t
+++ b/tests/test-lock-badness.t
@@ -26,7 +26,7 @@ 
   >     l = repo._lock(repo.vfs, 'testlock', False, unlock, None, 'test lock')
   >     return l
   > 
-  > @command('testlockexc')
+  > @command(b'testlockexc')
   > def testlockexc(ui, repo):
   >     testlock = acquiretestlock(repo, True)
   >     try:
diff --git a/tests/test-logtoprocess.t b/tests/test-logtoprocess.t
--- a/tests/test-logtoprocess.t
+++ b/tests/test-logtoprocess.t
@@ -12,7 +12,7 @@ 
   > from time import sleep
   > cmdtable = {}
   > command = registrar.command(cmdtable)
-  > @command('foo', [])
+  > @command(b'foo', [])
   > def foo(ui, repo):
   >     ui.log('foo', 'a message: %(bar)s\n', bar='spam')
   > EOF
diff --git a/tests/test-obsolete.t b/tests/test-obsolete.t
--- a/tests/test-obsolete.t
+++ b/tests/test-obsolete.t
@@ -1107,7 +1107,7 @@ 
   > 
   > cmdtable = {}
   > command = registrar.command(cmdtable)
-  > @command("amendtransient",[], _('hg amendtransient [rev]'))
+  > @command(b"amendtransient",[], _('hg amendtransient [rev]'))
   > def amend(ui, repo, *pats, **opts):
   >   def commitfunc(ui, repo, message, match, opts):
   >     return repo.commit(message, repo['.'].user(), repo['.'].date(), match)
diff --git a/tests/test-pager-legacy.t b/tests/test-pager-legacy.t
--- a/tests/test-pager-legacy.t
+++ b/tests/test-pager-legacy.t
@@ -217,7 +217,7 @@ 
   > from mercurial import registrar, commands
   > cmdtable = {}
   > command = registrar.command(cmdtable)
-  > @command('fortytwo', [], 'fortytwo', norepo=True)
+  > @command(b'fortytwo', [], 'fortytwo', norepo=True)
   > def fortytwo(ui, *opts):
   >     ui.write('42\n')
   >     return 42
diff --git a/tests/test-pager.t b/tests/test-pager.t
--- a/tests/test-pager.t
+++ b/tests/test-pager.t
@@ -230,7 +230,7 @@ 
   > from mercurial import commands, registrar
   > cmdtable = {}
   > command = registrar.command(cmdtable)
-  > @command('fortytwo', [], 'fortytwo', norepo=True)
+  > @command(b'fortytwo', [], 'fortytwo', norepo=True)
   > def fortytwo(ui, *opts):
   >     ui.write('42\n')
   >     return 42
diff --git a/tests/test-profile.t b/tests/test-profile.t
--- a/tests/test-profile.t
+++ b/tests/test-profile.t
@@ -68,7 +68,7 @@ 
   > from mercurial import registrar, commands
   > cmdtable = {}
   > command = registrar.command(cmdtable)
-  > @command('sleep', [], 'hg sleep')
+  > @command(b'sleep', [], 'hg sleep')
   > def sleep(ui, *args, **kwargs):
   >     time.sleep(0.1)
   > EOF
diff --git a/tests/test-progress.t b/tests/test-progress.t
--- a/tests/test-progress.t
+++ b/tests/test-progress.t
@@ -14,7 +14,7 @@ 
   >         return self._time
   > time.time = incrementingtime()
   > 
-  > @command('loop',
+  > @command(b'loop',
   >     [('', 'total', '', 'override for total'),
   >     ('', 'nested', False, 'show nested results'),
   >     ('', 'parallel', False, 'show parallel sets of results')],
diff --git a/tests/test-rebuildstate.t b/tests/test-rebuildstate.t
--- a/tests/test-rebuildstate.t
+++ b/tests/test-rebuildstate.t
@@ -3,7 +3,7 @@ 
   > from mercurial import registrar
   > cmdtable = {}
   > command = registrar.command(cmdtable)
-  > @command('debugadddrop',
+  > @command(b'debugadddrop',
   >   [('', 'drop', False, 'drop file from dirstate', 'FILE'),
   >    ('', 'normal-lookup', False, 'add file to dirstate', 'FILE')],
   >     'hg debugadddrop')
diff --git a/tests/test-resolve.t b/tests/test-resolve.t
--- a/tests/test-resolve.t
+++ b/tests/test-resolve.t
@@ -88,7 +88,7 @@ 
   > from mercurial import merge, registrar, scmutil
   > cmdtable = {}
   > command = registrar.command(cmdtable)
-  > @command('markdriver',
+  > @command(b'markdriver',
   >   [('u', 'unmark', None, '')],
   >   'FILE...')
   > def markdriver(ui, repo, *pats, **opts):
diff --git a/tests/test-revset.t b/tests/test-revset.t
--- a/tests/test-revset.t
+++ b/tests/test-revset.t
@@ -45,7 +45,7 @@ 
   > )
   > cmdtable = {}
   > command = registrar.command(cmdtable)
-  > @command('debugrevlistspec',
+  > @command(b'debugrevlistspec',
   >     [('', 'optimize', None, 'print parsed tree after optimizing'),
   >      ('', 'bin', None, 'unhexlify arguments')])
   > def debugrevlistspec(ui, repo, fmt, *args, **opts):
diff --git a/tests/test-worker.t b/tests/test-worker.t
--- a/tests/test-worker.t
+++ b/tests/test-worker.t
@@ -31,7 +31,7 @@ 
   > }
   > cmdtable = {}
   > command = registrar.command(cmdtable)
-  > @command('test', [], 'hg test [COST] [FUNC]')
+  > @command(b'test', [], 'hg test [COST] [FUNC]')
   > def t(ui, repo, cost=1.0, func='runme'):
   >     cost = float(cost)
   >     func = functable[func]