How do I tell Jenkins to run a Python Flask application, then Selenium tests, then close the Flask application? How do I tell Jenkins to run a Python Flask application, then Selenium tests, then close the Flask application? flask flask

How do I tell Jenkins to run a Python Flask application, then Selenium tests, then close the Flask application?


I'm not aware of an official way to cause the development server to exit under Selenium control, but the following route works with Flask 1.1.2

from flask import request...if settings.DEBUG:    @app.route('/quit')    def quit():        shutdown_hook = request.environ.get('werkzeug.server.shutdown')        if shutdown_hook is not None:            shutdown_hook()            return "Bye"        return "No shutdown hook"