def api_backend(rest_api_port_number):
# Initializing it without raiden_service.api here since that is a
# function scope fixture. We will inject it to rest_api object later
rest_api = RestAPI(None)
api_server = APIServer(rest_api)
api_server.flask_app.config['SERVER_NAME'] = 'localhost:{}'.format(rest_api_port_number)
# TODO: Find out why tests fail with debug=True
server = Greenlet.spawn(
api_server.run,
port=rest_api_port_number,
debug=False,
use_evalex=False,
)
# Fixes flaky test, were requests are done prior to the server initializing
# the listening socket.
# https://github.com/raiden-network/raiden/issues/389#issuecomment-305551563
wait_for_listening_port(rest_api_port_number)
yield api_server, rest_api
server.kill(block=True, timeout=10)
评论列表
文章目录