Rev 4904: Bring in the make_client_with_failing_medium cleanups. in http://bazaar.launchpad.net/~jameinel/bzr/2.1-client-stream-started-819604
John Arbash Meinel
john at arbash-meinel.com
Mon Oct 10 12:09:36 UTC 2011
At http://bazaar.launchpad.net/~jameinel/bzr/2.1-client-stream-started-819604
------------------------------------------------------------
revno: 4904 [merge]
revision-id: john at arbash-meinel.com-20111010120917-ni5eolmjok70s0vi
parent: john at arbash-meinel.com-20111008103614-zx2lroae5c1re300
parent: john at arbash-meinel.com-20111010120648-h5er54hkfzmowt3j
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.1-client-stream-started-819604
timestamp: Mon 2011-10-10 14:09:17 +0200
message:
Bring in the make_client_with_failing_medium cleanups.
modified:
bzrlib/tests/test_smart_transport.py test_ssh_transport.py-20060608202016-c25gvf1ob7ypbus6-2
-------------- next part --------------
=== modified file 'bzrlib/tests/test_smart_transport.py'
--- a/bzrlib/tests/test_smart_transport.py 2011-10-08 10:36:14 +0000
+++ b/bzrlib/tests/test_smart_transport.py 2011-10-10 12:09:17 +0000
@@ -3408,6 +3408,17 @@
class Test_SmartClientRequest(tests.TestCase):
+ def make_client_with_failing_medium(self, fail_at_write=True):
+ response = StringIO()
+ output = StringIO()
+ vendor = FirstRejectedStringIOSSHVendor(response, output,
+ fail_at_write=fail_at_write)
+ client_medium = medium.SmartSSHClientMedium(
+ 'a host', 'a port', 'a user', 'a pass', 'base', vendor,
+ 'bzr')
+ smart_client = client._SmartClient(client_medium, headers={})
+ return output, vendor, smart_client
+
def test__send_no_retry_pipes(self):
client_read, server_write = create_file_pipes()
server_read, client_write = create_file_pipes()
@@ -3441,13 +3452,7 @@
handler.read_response_tuple, expect_body=False)
def test__send_retries_on_write(self):
- response = StringIO()
- output = StringIO()
- vendor = FirstRejectedStringIOSSHVendor(response, output)
- client_medium = medium.SmartSSHClientMedium(
- 'a host', 'a port', 'a user', 'a pass', 'base', vendor,
- 'bzr')
- smart_client = client._SmartClient(client_medium, headers={})
+ output, vendor, smart_client = self.make_client_with_failing_medium()
smart_request = client._SmartClientRequest(smart_client, 'hello', ())
handler = smart_request._send(3)
self.assertEqual('bzr message 3 (bzr 1.6)\n' # protocol
@@ -3464,14 +3469,8 @@
vendor.calls)
def test__send_doesnt_retry_read_failure(self):
- response = StringIO()
- output = StringIO()
- vendor = FirstRejectedStringIOSSHVendor(response, output,
- fail_at_write=False)
- client_medium = medium.SmartSSHClientMedium(
- 'a host', 'a port', 'a user', 'a pass', 'base', vendor,
- 'bzr')
- smart_client = client._SmartClient(client_medium, headers={})
+ output, vendor, smart_client = self.make_client_with_failing_medium(
+ fail_at_write=False)
smart_request = client._SmartClientRequest(smart_client, 'hello', ())
handler = smart_request._send(3)
self.assertEqual('bzr message 3 (bzr 1.6)\n' # protocol
@@ -3486,13 +3485,7 @@
self.assertRaises(errors.ConnectionReset, handler.read_response_tuple)
def test__send_request_retries_body_stream_if_not_started(self):
- response = StringIO()
- output = StringIO()
- vendor = FirstRejectedStringIOSSHVendor(response, output)
- client_medium = medium.SmartSSHClientMedium(
- 'a host', 'a port', 'a user', 'a pass', 'base', vendor,
- 'bzr')
- smart_client = client._SmartClient(client_medium, headers={})
+ output, vendor, smart_client = self.make_client_with_failing_medium()
smart_request = client._SmartClientRequest(smart_client, 'hello', (),
body_stream=['a', 'b'])
response_handler = smart_request._send(3)
More information about the bazaar-commits
mailing list