Patchwork [3,of,4] py3: don't str() to byte-stringify object in test-bundle2-remote-changegroup.t

login
register
mail settings
Submitter Yuya Nishihara
Date July 12, 2018, 2:17 p.m.
Message ID <e06128d929f7ae7bde69.1531405049@mimosa>
Download mbox | patch
Permalink /patch/32816/
State Accepted
Headers show

Comments

Yuya Nishihara - July 12, 2018, 2:17 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1531046691 -32400
#      Sun Jul 08 19:44:51 2018 +0900
# Node ID e06128d929f7ae7bde69af75d6030e4a71db4fba
# Parent  e934284b4390484eb576a1e9275bf7c97a758d04
py3: don't str() to byte-stringify object in test-bundle2-remote-changegroup.t

Patch

diff --git a/tests/test-bundle2-remote-changegroup.t b/tests/test-bundle2-remote-changegroup.t
--- a/tests/test-bundle2-remote-changegroup.t
+++ b/tests/test-bundle2-remote-changegroup.t
@@ -16,7 +16,14 @@  Create an extension to test bundle2 remo
   > Current bundle2 implementation doesn't provide a way to generate those
   > parts, so they must be created by extensions.
   > """
-  > from mercurial import bundle2, changegroup, discovery, exchange, util
+  > from mercurial import (
+  >     bundle2,
+  >     changegroup,
+  >     discovery,
+  >     exchange,
+  >     pycompat,
+  >     util,
+  > )
   > 
   > def _getbundlechangegrouppart(bundler, repo, source, bundlecaps=None,
   >                               b2caps=None, heads=None, common=None,
@@ -60,13 +67,13 @@  Create an extension to test bundle2 remo
   >            d = util.digester([digest], bundledata)
   >            part = newpart(b'remote-changegroup')
   >            part.addparam(b'url', url)
-  >            part.addparam(b'size', str(len(bundledata)))
+  >            part.addparam(b'size', b'%d' % len(bundledata))
   >            part.addparam(b'digests', digest)
   >            part.addparam(b'digest:%s' % digest, d[digest])
   >         elif verb == b'raw-remote-changegroup':
   >            part = newpart(b'remote-changegroup')
   >            for k, v in eval(args).items():
-  >                part.addparam(k, str(v))
+  >                part.addparam(pycompat.sysbytes(k), pycompat.bytestr(v))
   >         elif verb == b'changegroup':
   >             _common, heads = args.split()
   >             common.extend(repo[r].node() for r in repo.revs(_common))