Exemplo n.º 1
0
 def test_infinite_sendprepared(self):
     """
     Tries sending data (and not reading them) until it either times
     out (in blocking call, wrong) or closes it (correct).
     """
     data = b"data"
     for i in range(1, 10):
         data += data
     self.terminate_check(lambda: self.infinite_sender(
         lambda msgq, socket: msgq.send_prepared_msg(socket, data)))
Exemplo n.º 2
0
 def test_infinite_sendprepared(self):
     """
     Tries sending data (and not reading them) until it either times
     out (in blocking call, wrong) or closes it (correct).
     """
     data = b"data"
     for i in range(1, 10):
         data += data
     self.terminate_check(lambda: self.infinite_sender(
         lambda msgq, socket: msgq.send_prepared_msg(socket, data)))
Exemplo n.º 3
0
 def test_sendprepared_epipe(self):
     '''
     Test the send_prepared_msg returns false when we try to queue a
     message and the other side is not there any more. It should be done
     with EPIPE, so not a fatal error.
     '''
     (msgq, read, write) = self.get_msgq_with_sockets()
     # Close one end. It should make a EPIPE on the other.
     read.close()
     # Now it should soft-fail
     self.assertFalse(msgq.send_prepared_msg(write, b'data'))
     write.close()
Exemplo n.º 4
0
 def test_sendprepared_epipe(self):
     '''
     Test the send_prepared_msg returns false when we try to queue a
     message and the other side is not there any more. It should be done
     with EPIPE, so not a fatal error.
     '''
     (msgq, read, write) = self.get_msgq_with_sockets()
     # Close one end. It should make a EPIPE on the other.
     read.close()
     # Now it should soft-fail
     self.assertFalse(msgq.send_prepared_msg(write, b'data'))
     write.close()
Exemplo n.º 5
0
 def test_sendprepared_success(self):
     '''
     Test the send_prepared_msg returns success when queueing messages.
     It does so on the first attempt (when it actually tries to send
     something to the socket) and on any attempt that follows and the
     buffer is already full.
     '''
     (msgq, read, write) = self.get_msgq_with_sockets()
     # Now keep sending until we fill in something into the internal
     # buffer.
     while not write.fileno() in msgq.sendbuffs:
         self.assertTrue(msgq.send_prepared_msg(write, b'data'))
     read.close()
     write.close()
Exemplo n.º 6
0
 def test_sendprepared_success(self):
     '''
     Test the send_prepared_msg returns success when queueing messages.
     It does so on the first attempt (when it actually tries to send
     something to the socket) and on any attempt that follows and the
     buffer is already full.
     '''
     (msgq, read, write) = self.get_msgq_with_sockets()
     # Now keep sending until we fill in something into the internal
     # buffer.
     while not write.fileno() in msgq.sendbuffs:
         self.assertTrue(msgq.send_prepared_msg(write, b'data'))
     read.close()
     write.close()