Patchwork D2309: tests: port inline Python in test-http-branchmap.t to Python 3

login
register
mail settings
Submitter phabricator
Date Feb. 18, 2018, 12:47 p.m.
Message ID <fdbebf5d6de3252fbc8eb419be2b926d@localhost.localdomain>
Download mbox | patch
Permalink /patch/28070/
State Not Applicable
Headers show

Comments

phabricator - Feb. 18, 2018, 12:47 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG1e0c9f9f6f36: tests: port inline Python in test-http-branchmap.t to Python 3 (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2309?vs=5827&id=5846

REVISION DETAIL
  https://phab.mercurial-scm.org/D2309

AFFECTED FILES
  tests/test-http-branchmap.t

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/tests/test-http-branchmap.t b/tests/test-http-branchmap.t
--- a/tests/test-http-branchmap.t
+++ b/tests/test-http-branchmap.t
@@ -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