

@reap_threads
def run_server(self, svrcls, hdlrbase, testfunc):
    server = self.make_server(self.pickaddr(svrcls.address_family), svrcls, hdlrbase)
    addr = server.server_address
    if verbose:
        print('ADDR =', addr)
        print('CLASS =', svrcls)
    t = threading.Thread(name=('%s serving' % svrcls), target=server.serve_forever, kwargs={
        'poll_interval': 0.01,
    })
    t.daemon = True
    t.start()
    if verbose:
        print('server running')
    for i in range(3):
        if verbose:
            print('test client', i)
        testfunc(svrcls.address_family, addr)
    if verbose:
        print('waiting for server')
    server.shutdown()
    t.join()
    server.server_close()
    if verbose:
        print('done')

dataset/ETHPy150Open amrdraz/kodr/app/brython/www/src/Lib/test/test_socketserver.py SocketServerTest.run_server/original