tests: port inline Python in test-http-branchmap.t to Python 3
authorAugie Fackler <augie@google.com>
Sun, 18 Feb 2018 00:01:43 -0500
changeset 36312 1e0c9f9f6f36
parent 36311 a87093e2805d
child 36313 685bcdd236b5
tests: port inline Python in test-http-branchmap.t to Python 3 Differential Revision: https://phab.mercurial-scm.org/D2309
tests/test-http-branchmap.t
--- a/tests/test-http-branchmap.t	Sat Feb 17 22:52:24 2018 -0500
+++ b/tests/test-http-branchmap.t	Sun Feb 18 00:01:43 2018 -0500
@@ -68,22 +68,22 @@
   >         self._file = stdout
   > 
   >     def write(self, data):
-  >         if data == '47\n':
+  >         if data == b'47\n':
   >             # latin1 encoding is one %xx (3 bytes) shorter
-  >             data = '44\n'
-  >         elif data.startswith('%C3%A6 '):
+  >             data = b'44\n'
+  >         elif data.startswith(b'%C3%A6 '):
   >             # translate to latin1 encoding
-  >             data = '%%E6 %s' % data[7:]
+  >             data = b'%%E6 %s' % data[7:]
   >         self._file.write(data)
   > 
   >     def __getattr__(self, name):
   >         return getattr(self._file, name)
   > 
-  > sys.stdout = StdoutWrapper(sys.stdout)
-  > sys.stderr = StdoutWrapper(sys.stderr)
+  > sys.stdout = StdoutWrapper(getattr(sys.stdout, 'buffer', sys.stdout))
+  > sys.stderr = StdoutWrapper(getattr(sys.stderr, 'buffer', sys.stderr))
   > 
   > myui = ui.ui.load()
-  > repo = hg.repository(myui, 'a')
+  > repo = hg.repository(myui, b'a')
   > commands.serve(myui, repo, stdio=True, cmdserver=False)
   > EOF
   $ echo baz >> b/foo