class TestTCP(Process): def __init__(self, num_reqs, pipe): self.num_reqs = num_reqs self.pipe = pipe self.client = TCPClient() super(TestTCP, self).__init__() def run(self): for i in xrange(self.num_reqs): res = self.client.execute(cmd='add', x=1, y=2) assert res['success'] and res['result'] == 3 done = True self.pipe.send(done)