~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_smart_transport.py

  • Committer: John Arbash Meinel
  • Date: 2011-09-15 09:55:32 UTC
  • mto: (6133.4.49 2.5-soft-hangup-795025)
  • mto: This revision was merged to the branch mainline in revision 6170.
  • Revision ID: john@arbash-meinel.com-20110915095532-ayzf3aub59k9roh2
Add some tests to make sure the timeout parameter gets propagated upwards correctly.

Show diffs side-by-side

added added

removed removed

Lines of Context:
935
935
        server_protocol = self.build_protocol_socket('bzr request 2\n')
936
936
        self.assertProtocolTwo(server_protocol)
937
937
 
 
938
    def test_socket_default_timeout(self):
 
939
        server_sock, client_sock = self.portable_socket_pair()
 
940
        server = medium.SmartServerSocketStreamMedium(server_sock, None)
 
941
        self.assertEqual(server._DEFAULT_CLIENT_TIMEOUT,
 
942
                         server._client_timeout)
 
943
 
 
944
    def test_socket_set_timeout(self):
 
945
        server_sock, client_sock = self.portable_socket_pair()
 
946
        server = medium.SmartServerSocketStreamMedium(server_sock, None,
 
947
            timeout=1.23)
 
948
        self.assertEqual(1.23, server._client_timeout)
 
949
 
 
950
    def test_pipe_default_timeout(self):
 
951
        server = medium.SmartServerPipeStreamMedium(None, None, None)
 
952
        self.assertEqual(server._DEFAULT_CLIENT_TIMEOUT,
 
953
                         server._client_timeout)
 
954
 
 
955
    def test_pipe_set_timeout(self):
 
956
        server = medium.SmartServerPipeStreamMedium(None, None, None,
 
957
            timeout=1.23)
 
958
        self.assertEqual(1.23, server._client_timeout)
 
959
 
938
960
    def test_socket_wait_for_bytes_with_timeout_with_data(self):
939
961
        server_sock, client_sock = self.portable_socket_pair()
940
962
        self.addCleanup(server_sock.close)