def run_test_server():
 httpd = BaseHTTPServer.HTTPServer(('127.0.0.1', 0), Handler)
 thread = threading.Thread(target=httpd.handle_request)
 thread.daemon = True
 thread.start()
 def finish():
  print ('Closing thread ' + str(thread))
  thread.join(10.0)
  assert_false(thread.isAlive())
 return (httpd, finish)

def run_test_server ( ) : httpd = BaseHTTPServer . HTTPServer ( ( '127.0.0.1' , 0 ) , Handler ) thread = threading . Thread ( target = httpd . handle_request ) thread . daemon = True thread . start ( ) def finish ( ) : print ( 'Closing thread ' + str ( thread ) ) thread . join ( 10.0 ) assert_false ( thread . isAlive ( ) ) return ( httpd , finish )
returns the server .