Patchwork [01,of,11] py3: add b'' prefixes in test-dispatch.py

login
register
mail settings
Submitter Pulkit Goyal
Date Feb. 23, 2018, 6:15 p.m.
Message ID <ea8a43155c3d51289609.1519409714@workspace>
Download mbox | patch
Permalink /patch/28283/
State Accepted
Headers show

Comments

Pulkit Goyal - Feb. 23, 2018, 6:15 p.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@gmail.com>
# Date 1519236803 -19800
#      Wed Feb 21 23:43:23 2018 +0530
# Node ID ea8a43155c3d51289609afeda8659b4d604b2e1e
# Parent  b8d0761a85c7421071750de23228415306852d69
py3: add b'' prefixes in test-dispatch.py

# skip-blame because this is just adding b'' prefixes
Gregory Szorc - Feb. 24, 2018, 2:51 a.m.
On Fri, Feb 23, 2018 at 10:15 AM, Pulkit Goyal <7895pulkit@gmail.com> wrote:

> # HG changeset patch
> # User Pulkit Goyal <7895pulkit@gmail.com>
> # Date 1519236803 -19800
> #      Wed Feb 21 23:43:23 2018 +0530
> # Node ID ea8a43155c3d51289609afeda8659b4d604b2e1e
> # Parent  b8d0761a85c7421071750de23228415306852d69
> py3: add b'' prefixes in test-dispatch.py
>

Queued this series.

(I missed Phabricator's diff highlighting when reviewing this: it makes
things like b'' prefixes so much easier to review.)


>
> # skip-blame because this is just adding b'' prefixes
>
> diff --git a/tests/test-dispatch.py b/tests/test-dispatch.py
> --- a/tests/test-dispatch.py
> +++ b/tests/test-dispatch.py
> @@ -9,27 +9,27 @@ def testdispatch(cmd):
>
>      Prints command and result value, but does not handle quoting.
>      """
> -    print("running: %s" % (cmd,))
> +    print(b"running: %s" % (cmd,))
>      req = dispatch.request(cmd.split())
>      result = dispatch.dispatch(req)
> -    print("result: %r" % (result,))
> +    print(b"result: %r" % (result,))
>
> -testdispatch("init test1")
> +testdispatch(b"init test1")
>  os.chdir('test1')
>
>  # create file 'foo', add and commit
>  f = open('foo', 'wb')
> -f.write('foo\n')
> +f.write(b'foo\n')
>  f.close()
> -testdispatch("add foo")
> -testdispatch("commit -m commit1 -d 2000-01-01 foo")
> +testdispatch(b"add foo")
> +testdispatch(b"commit -m commit1 -d 2000-01-01 foo")
>
>  # append to file 'foo' and commit
>  f = open('foo', 'ab')
> -f.write('bar\n')
> +f.write(b'bar\n')
>  f.close()
> -testdispatch("commit -m commit2 -d 2000-01-02 foo")
> +testdispatch(b"commit -m commit2 -d 2000-01-02 foo")
>
>  # check 88803a69b24 (fancyopts modified command table)
> -testdispatch("log -r 0")
> -testdispatch("log -r tip")
> +testdispatch(b"log -r 0")
> +testdispatch(b"log -r tip")
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>

Patch

diff --git a/tests/test-dispatch.py b/tests/test-dispatch.py
--- a/tests/test-dispatch.py
+++ b/tests/test-dispatch.py
@@ -9,27 +9,27 @@  def testdispatch(cmd):
 
     Prints command and result value, but does not handle quoting.
     """
-    print("running: %s" % (cmd,))
+    print(b"running: %s" % (cmd,))
     req = dispatch.request(cmd.split())
     result = dispatch.dispatch(req)
-    print("result: %r" % (result,))
+    print(b"result: %r" % (result,))
 
-testdispatch("init test1")
+testdispatch(b"init test1")
 os.chdir('test1')
 
 # create file 'foo', add and commit
 f = open('foo', 'wb')
-f.write('foo\n')
+f.write(b'foo\n')
 f.close()
-testdispatch("add foo")
-testdispatch("commit -m commit1 -d 2000-01-01 foo")
+testdispatch(b"add foo")
+testdispatch(b"commit -m commit1 -d 2000-01-01 foo")
 
 # append to file 'foo' and commit
 f = open('foo', 'ab')
-f.write('bar\n')
+f.write(b'bar\n')
 f.close()
-testdispatch("commit -m commit2 -d 2000-01-02 foo")
+testdispatch(b"commit -m commit2 -d 2000-01-02 foo")
 
 # check 88803a69b24 (fancyopts modified command table)
-testdispatch("log -r 0")
-testdispatch("log -r tip")
+testdispatch(b"log -r 0")
+testdispatch(b"log -r tip")