def setUpClass(cls): attempts = 0 cls.httpd = None sys.stdout.write("Waiting for web-server to start ...") sys.stdout.flush() while cls.httpd is None and attempts < 20: try: cls.httpd = get_server(8888) print " Done" except IOError: cls.httpd = None time.sleep(2) attempts = attempts + 1 sys.stdout.write(".") sys.stdout.flush() def start_server(httpd): httpd.serve_forever() t = threading.Thread(target=start_server, args = (cls.httpd,)) t.daemon = True t.start()
def setUpClass(cls): cls.httpd = get_server(8888) def start_server(httpd): httpd.serve_forever() t = threading.Thread(target=start_server, args = (cls.httpd,)) t.daemon = True t.start()