def start_http_server(listen_port):
 _verify_environment()
 logging.info("HTTP server is starting, port: {}, test-UUID: '{}'".format(listen_port, os.environ[TEST_UUID_VARNAME]))
 test_server = ThreadingSimpleServer(('', listen_port), TestHTTPRequestHandler)
 def sigterm_handler(_signo, _stack_frame):
  test_server.server_close()
  logging.info('HTTP server is terminating')
  sys.exit(0)
 signal.signal(signal.SIGTERM, sigterm_handler)
 signal.signal(signal.SIGINT, sigterm_handler)
 test_server.serve_forever()

def start_http_server ( listen_port ) : _verify_environment ( ) logging . info ( "HTTP server is starting, port: {}, test-UUID: '{}'" . format ( listen_port , os . environ [ TEST_UUID_VARNAME ] ) ) test_server = ThreadingSimpleServer ( ( '' , listen_port ) , TestHTTPRequestHandler ) def sigterm_handler ( _signo , _stack_frame ) : test_server . server_close ( ) logging . info ( 'HTTP server is terminating' ) sys . exit ( 0 ) signal . signal ( signal . SIGTERM , sigterm_handler ) signal . signal ( signal . SIGINT , sigterm_handler ) test_server . serve_forever ( )
start the test server this function makes sure that the environment is sane and signals are properly handled .