/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_smart_transport.py

  • Committer: John Arbash Meinel
  • Date: 2011-09-22 11:51:16 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-20110922115116-bhb0waixysjzjcda
Change the code to just raise ConnectionTimeout.

It isn't a big deal one way or another, but in the end, we want
a timeout. I think originally I was hoping we would have more
context that we could log/etc, but we don't seem to have it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
956
956
    def test_socket_wait_for_bytes_with_timeout_no_data(self):
957
957
        server, client_sock = self.create_stream_context(None)
958
958
        # This should timeout quickly, reporting that there wasn't any data
959
 
        self.assertTrue(server._wait_for_bytes_with_timeout(0.01))
 
959
        self.assertRaises(errors.ConnectionTimeout,
 
960
                          server._wait_for_bytes_with_timeout, 0.01)
960
961
        client_sock.close()
961
962
        data = server.read_bytes(1)
962
963
        self.assertEqual('', data)
990
991
                rf_server, None, None)
991
992
            os.write(w_client, 'data\n')
992
993
            # This should not block or consume any actual content
993
 
            self.assertFalse(server._wait_for_bytes_with_timeout(0.1))
 
994
            server._wait_for_bytes_with_timeout(0.1)
994
995
            data = server.read_bytes(5)
995
996
            self.assertEqual('data\n', data)
996
997
 
1005
1006
                rf_server, None, None)
1006
1007
            if sys.platform == 'win32':
1007
1008
                # Windows cannot select() on a pipe, so we just always return
1008
 
                # False to indicate that we have to block.
1009
 
                self.assertFalse(server._wait_for_bytes_with_timeout(0.01))
 
1009
                server._wait_for_bytes_with_timeout(0.01)
1010
1010
            else:
1011
 
                self.assertTrue(server._wait_for_bytes_with_timeout(0.01))
 
1011
                self.assertRaises(errors.ConnectionTimeout,
 
1012
                                  server._wait_for_bytes_with_timeout, 0.01)
1012
1013
            os.close(w_client)
1013
1014
            data = server.read_bytes(5)
1014
1015
            self.assertEqual('', data)
1017
1018
        server, _ = self.create_pipe_context('', None)
1018
1019
        # Our file doesn't support polling, so we should always just return
1019
1020
        # 'you have data to consume.
1020
 
        self.assertFalse(server._wait_for_bytes_with_timeout(0.01))
 
1021
        server._wait_for_bytes_with_timeout(0.01)
1021
1022
 
1022
1023
 
1023
1024
class TestGetProtocolFactoryForBytes(tests.TestCase):