Rev 4884: Start writing a test of how subprocess handles writing to a closed connection. in http://bazaar.launchpad.net/~jameinel/bzr/2.1-client-reconnect-819604
John Arbash Meinel
john at arbash-meinel.com
Wed Sep 28 14:26:12 UTC 2011
At http://bazaar.launchpad.net/~jameinel/bzr/2.1-client-reconnect-819604
------------------------------------------------------------
revno: 4884
revision-id: john at arbash-meinel.com-20110928142559-qp5pxasjovebzatk
parent: john at arbash-meinel.com-20110926151814-3lscd6w6mupznpw5
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.1-client-reconnect-819604
timestamp: Wed 2011-09-28 16:25:59 +0200
message:
Start writing a test of how subprocess handles writing to a closed connection.
On Windows, I reliably get IOError(EINVAL) trying to do the write, need to check other OS.
-------------- next part --------------
=== modified file 'bzrlib/tests/test_smart_transport.py'
--- a/bzrlib/tests/test_smart_transport.py 2010-02-17 17:11:16 +0000
+++ b/bzrlib/tests/test_smart_transport.py 2011-09-28 14:25:59 +0000
@@ -20,6 +20,8 @@
from cStringIO import StringIO
import os
import socket
+import subprocess
+import sys
import threading
import bzrlib
@@ -171,6 +173,20 @@
client_medium._accept_bytes('abc')
self.assertEqual('abc', output.getvalue())
+ def test_simple_pipes_accept_bytes_closed_pipe(self):
+ p = subprocess.Popen([sys.executable, '-c',
+ 'import sys\n'
+ 'sys.stdout.write(sys.stdin.read(3))\n'
+ 'sys.stdout.close()\n'],
+ stdout=subprocess.PIPE, stdin=subprocess.PIPE)
+ client_medium = medium.SmartSimplePipesClientMedium(
+ p.stdout, p.stdin, 'base')
+ client_medium._accept_bytes('abc')
+ self.assertEqual('abc', client_medium._read_bytes(3))
+ p.wait()
+ # On win32 python2.6 we get IOError(EINVAL) trying to do this.
+ client_medium._accept_bytes('more')
+
def test_simple_pipes_client_disconnect_does_nothing(self):
# calling disconnect does nothing.
input = StringIO()
More information about the bazaar-commits
mailing list