def _test_sendall(self, data, match_data=None, client_method='sendall', **client_args): read_data = [] server_exc_info = [] def accept_and_read(): try: conn, _ = self.listener.accept() r = conn.makefile(mode='rb') read_data.append(r.read()) r.close() conn.close() except: server_exc_info.append(sys.exc_info()) server = Thread(target=accept_and_read) client = self.create_connection(**client_args) try: getattr(client, client_method)(data) finally: client.shutdown(socket.SHUT_RDWR) client.close() server.join() if match_data is None: match_data = self.long_data self.assertEqual(read_data[0], match_data) if server_exc_info: six.reraise(*server_exc_info[0])
def reraiseFlakyTestRaceCondition(): six.reraise(FlakyTestRaceCondition, FlakyTestRaceCondition('\n'.join(dump_stacks())), sys.exc_info()[2])
def reraiseFlakyTestTimeout(): six.reraise(FlakyTestTimeout, FlakyTestTimeout(), sys.exc_info()[2])
def reraiseFlakyTestRaceCondition(): six.reraise(*sys.exc_info())