Patchwork [1,of,2] test-http-branchmap: fix encoding test to wrap the server stream

login
register
mail settings
Submitter Yuya Nishihara
Date May 13, 2018, 2:27 a.m.
Message ID <af07d426066dd8326c50.1526178434@mimosa>
Download mbox | patch
Permalink /patch/31567/
State Accepted
Headers show

Comments

Yuya Nishihara - May 13, 2018, 2:27 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1526177315 -32400
#      Sun May 13 11:08:35 2018 +0900
# Node ID af07d426066dd8326c50a5686d7ecd25072d67b3
# Parent  6f9ac3cb098750529b832ab902ad93c72dc5b8c8
test-http-branchmap: fix encoding test to wrap the server stream

Wrapping sys.std* streams has no effect since 39d13b8c101d, "py3: bulk
replace sys.stdin/out/err by util's."

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
@@ -58,8 +58,8 @@ 
 verify 7e7d56fe4833 (encoding fallback in branchmap to maintain compatibility with 1.3.x)
 
   $ cat <<EOF > oldhg
-  > import sys
-  > from mercurial import ui, hg, commands
+  > import threading
+  > from mercurial import hg, ui, wireprotoserver
   > 
   > class StdoutWrapper(object):
   >     def __init__(self, stdout):
@@ -77,12 +77,11 @@  verify 7e7d56fe4833 (encoding fallback i
   >     def __getattr__(self, name):
   >         return getattr(self._file, name)
   > 
-  > sys.stdout = StdoutWrapper(getattr(sys.stdout, 'buffer', sys.stdout))
-  > sys.stderr = StdoutWrapper(getattr(sys.stderr, 'buffer', sys.stderr))
-  > 
   > myui = ui.ui.load()
+  > fout = StdoutWrapper(myui.fout)
+  > myui.fout = myui.ferr
   > repo = hg.repository(myui, b'a')
-  > commands.serve(myui, repo, stdio=True, cmdserver=False)
+  > wireprotoserver._runsshserver(myui, repo, myui.fin, fout, threading.Event())
   > EOF
   $ echo baz >> b/foo
   $ hg -R b ci -m baz