Patchwork [3,of,3] test-sshserver: stabilize for Windows

login
register
mail settings
Submitter Matt Harbison
Date Jan. 20, 2018, 8:14 p.m.
Message ID <1dd5724664ab53e0cf2a.1516479265@Envy>
Download mbox | patch
Permalink /patch/27004/
State Accepted
Headers show

Comments

Matt Harbison - Jan. 20, 2018, 8:14 p.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1516476100 18000
#      Sat Jan 20 14:21:40 2018 -0500
# Node ID 1dd5724664ab53e0cf2a69809bb3f4158d4e30d7
# Parent  ebb75443969ae8b4c750b7f082387bb126e2978f
test-sshserver: stabilize for Windows
Yuya Nishihara - Jan. 21, 2018, 2:42 a.m.
On Sat, 20 Jan 2018 15:14:25 -0500, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1516476100 18000
> #      Sat Jan 20 14:21:40 2018 -0500
> # Node ID 1dd5724664ab53e0cf2a69809bb3f4158d4e30d7
> # Parent  ebb75443969ae8b4c750b7f082387bb126e2978f
> test-sshserver: stabilize for Windows

Queued, thanks.

>  from mercurial import (
>      sshserver,
> +    util,
>      wireproto,
>  )
>  
> @@ -41,4 +42,6 @@
>          self.ferr = io.BytesIO()
>  
>  if __name__ == '__main__':
> +    # Don't call into msvcrt to set BytesIO to binary mode
> +    util.setbinary = lambda fp: True

Perhaps windows.setbinary() should catch IOError raised by io.BytesIO.fileno(),
but that isn't important now.

Patch

diff --git a/tests/test-sshserver.py b/tests/test-sshserver.py
--- a/tests/test-sshserver.py
+++ b/tests/test-sshserver.py
@@ -7,6 +7,7 @@ 
 
 from mercurial import (
     sshserver,
+    util,
     wireproto,
 )
 
@@ -41,4 +42,6 @@ 
         self.ferr = io.BytesIO()
 
 if __name__ == '__main__':
+    # Don't call into msvcrt to set BytesIO to binary mode
+    util.setbinary = lambda fp: True
     silenttestrunner.main(__name__)