Patchwork [6,of,6] tests: avoid repr in test-bundle2-format.t

login
register
mail settings
Submitter Augie Fackler
Date Sept. 19, 2017, 4:08 p.m.
Message ID <eef6eaa44b13c7d8f380.1505837309@augie-macbookpro2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/24023/
State Accepted
Headers show

Comments

Augie Fackler - Sept. 19, 2017, 4:08 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1505758787 14400
#      Mon Sep 18 14:19:47 2017 -0400
# Node ID eef6eaa44b13c7d8f3802776586d119f1dfb33f7
# Parent  df919997998c3a6fa3f3182a84a7d13011a58ed9
tests: avoid repr in test-bundle2-format.t

We don't *really* need it here, and it was making Python 3 harder.
Pulkit Goyal - Sept. 20, 2017, 1:52 a.m.
The series looks good to me.

On Tue, Sep 19, 2017 at 9:38 PM, Augie Fackler <raf@durin42.com> wrote:
> # HG changeset patch
> # User Augie Fackler <augie@google.com>
> # Date 1505758787 14400
> #      Mon Sep 18 14:19:47 2017 -0400
> # Node ID eef6eaa44b13c7d8f3802776586d119f1dfb33f7
> # Parent  df919997998c3a6fa3f3182a84a7d13011a58ed9
> tests: avoid repr in test-bundle2-format.t
>
> We don't *really* need it here, and it was making Python 3 harder.
>
> 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
> @@ -68,9 +68,9 @@ Create an extension to test bundle2 API
>    >     else:
>    >         op.ui.write(b'debugreply: capabilities:\n')
>    >         for cap in sorted(op.reply.capabilities):
> -  >             op.ui.write(b'debugreply:     %r\n' % cap)
> +  >             op.ui.write(b"debugreply:     '%s'\n" % cap)
>    >             for val in op.reply.capabilities[cap]:
> -  >                 op.ui.write(b'debugreply:         %r\n' % val)
> +  >                 op.ui.write(b"debugreply:         '%s'\n" % val)
>    >
>    > @command(b'bundle2',
>    >          [(b'', b'param', [], b'stream level parameter'),
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Yuya Nishihara - Sept. 20, 2017, 2:11 p.m.
On Wed, 20 Sep 2017 07:22:35 +0530, Pulkit Goyal wrote:
> The series looks good to me.
> 
> On Tue, Sep 19, 2017 at 9:38 PM, Augie Fackler <raf@durin42.com> wrote:
> > # HG changeset patch
> > # User Augie Fackler <augie@google.com>
> > # Date 1505758787 14400
> > #      Mon Sep 18 14:19:47 2017 -0400
> > # Node ID eef6eaa44b13c7d8f3802776586d119f1dfb33f7
> > # Parent  df919997998c3a6fa3f3182a84a7d13011a58ed9
> > tests: avoid repr in test-bundle2-format.t

Queued, thanks.

> > @@ -792,14 +792,14 @@ class unbundle20(unpackermixin):
> >                ignored or failing.
> >          """
> >          if not name:
> > -            raise ValueError('empty parameter name')
> > -        if name[0] not in pycompat.bytestr(string.ascii_letters):
> > -            raise ValueError('non letter first character: %r' % name)
> > +            raise ValueError(r'empty parameter name')
> > +        if name[0:1] not in pycompat.bytestr(string.ascii_letters):
> > +            raise ValueError(r'non letter first character: %s' % name)

Nit: actually name[0:1] isn't needed since 'int in bytes' just works, but
this change should be okay.
Augie Fackler - Sept. 20, 2017, 2:12 p.m.
> On Sep 20, 2017, at 10:11, Yuya Nishihara <yuya@tcha.org> wrote:
> 
> On Wed, 20 Sep 2017 07:22:35 +0530, Pulkit Goyal wrote:
>> The series looks good to me.
>> 
>> On Tue, Sep 19, 2017 at 9:38 PM, Augie Fackler <raf@durin42.com> wrote:
>>> # HG changeset patch
>>> # User Augie Fackler <augie@google.com>
>>> # Date 1505758787 14400
>>> #      Mon Sep 18 14:19:47 2017 -0400
>>> # Node ID eef6eaa44b13c7d8f3802776586d119f1dfb33f7
>>> # Parent  df919997998c3a6fa3f3182a84a7d13011a58ed9
>>> tests: avoid repr in test-bundle2-format.t
> 
> Queued, thanks.
> 
>>> @@ -792,14 +792,14 @@ class unbundle20(unpackermixin):
>>>               ignored or failing.
>>>         """
>>>         if not name:
>>> -            raise ValueError('empty parameter name')
>>> -        if name[0] not in pycompat.bytestr(string.ascii_letters):
>>> -            raise ValueError('non letter first character: %r' % name)
>>> +            raise ValueError(r'empty parameter name')
>>> +        if name[0:1] not in pycompat.bytestr(string.ascii_letters):
>>> +            raise ValueError(r'non letter first character: %s' % name)
> 
> Nit: actually name[0:1] isn't needed since 'int in bytes' just works, but
> this change should be okay.

Oh, hm. I guess the pycompat.bytestr() got introduced in a rebase step and I was on autopilot. Sigh.

Patch

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
@@ -68,9 +68,9 @@  Create an extension to test bundle2 API
   >     else:
   >         op.ui.write(b'debugreply: capabilities:\n')
   >         for cap in sorted(op.reply.capabilities):
-  >             op.ui.write(b'debugreply:     %r\n' % cap)
+  >             op.ui.write(b"debugreply:     '%s'\n" % cap)
   >             for val in op.reply.capabilities[cap]:
-  >                 op.ui.write(b'debugreply:         %r\n' % val)
+  >                 op.ui.write(b"debugreply:         '%s'\n" % val)
   > 
   > @command(b'bundle2',
   >          [(b'', b'param', [], b'stream level parameter'),