tests: test-archive.t use sys.stdout.buffer for binary output in py3
authortimeless <timeless@mozdev.org>
Fri, 06 May 2016 19:19:12 +0000
changeset 29182 6c0b1d964537
parent 29179 ce1c6ab15807
child 29183 6def44ab4769
tests: test-archive.t use sys.stdout.buffer for binary output in py3
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