Patchwork [4,of,5] tests: test-archive.t use sys.stdout.buffer for binary output in py3

login
register
mail settings
Submitter timeless
Date May 11, 2016, 5:21 a.m.
Message ID <a76f8fe3523dcf1cca11.1462944065@gcc2-power8.osuosl.org>
Download mbox | patch
Permalink /patch/15002/
State Accepted
Delegated to: Yuya Nishihara
Headers show

Comments

timeless - May 11, 2016, 5:21 a.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1462562352 0
#      Fri May 06 19:19:12 2016 +0000
# Node ID a76f8fe3523dcf1cca1111e7311579bf11f420c2
# Parent  48413cfd3a0873e14fb8227c7636bda9d42a0ef6
# EXP-Topic runtests
# Available At bb://timeless/mercurial-crew
#              hg pull bb://timeless/mercurial-crew -r a76f8fe3523d
tests: test-archive.t use sys.stdout.buffer for binary output in py3

Patch

diff -r 48413cfd3a08 -r a76f8fe3523d tests/test-archive.t
--- a/tests/test-archive.t	Fri May 06 19:17:49 2016 +0000
+++ b/tests/test-archive.t	Fri May 06 19:19:12 2016 +0000
@@ -86,9 +86,13 @@ 
   >     node, archive, file = sys.argv[1:]
   >     requeststr = 'cmd=archive;node=%s;type=%s;file=%s' % (node, archive, file)
   > try:
+  >     stdout = sys.stdout.buffer
+  > except AttributeError:
+  >     stdout = sys.stdout
+  > try:
   >     f = urllib2.urlopen('http://127.0.0.1:%s/?%s'
   >                     % (os.environ['HGPORT'], requeststr))
-  >     sys.stdout.write(f.read())
+  >     stdout.write(f.read())
   > except urllib2.HTTPError, e:
   >     sys.stderr.write(str(e) + '\n')
   > EOF