Exemplo n.º 1
0
def app():
    try:
        server_config = get_server_config()
    except (ConfigFileNotSpecified, BadConfig) as e:
        print(e)
        sys.exit(1)
    return create_app(server_config)
Exemplo n.º 2
0
def client(pytestconfig, monkeypatch):
    cfg_file = pytestconfig.cache.get("_PBENCH_SERVER_CONFIG", None)
    monkeypatch.setenv("_PBENCH_SERVER_CONFIG", cfg_file)
    app = create_app()
    app.testing = True
    """A test client for the app."""
    app_client = app.test_client()
    app_client.config = app.config
    return app_client
Exemplo n.º 3
0
def client(server_config):
    app = create_app(server_config)
    """A test client for the app."""
    app_client = app.test_client()
    app_client.logger = app.logger
    app_client.config = app.config
    app_client.debug = True
    app_client.testing = True
    return app_client
Exemplo n.º 4
0
def client(server_config):
    """A test client for the app.

    NOTE: the db_session fixture does something similar, but with implicit
    cleanup after the test, and without the Flask app setup DB tests don't
    require.
    """
    app = create_app(server_config)

    app_client = app.test_client()
    app_client.logger = app.logger
    app_client.config = app.config
    app_client.debug = True
    app_client.testing = True
    return app_client
Exemplo n.º 5
0
def main():
    app = create_app()
    port = app.config["PORT"]
    host = app.config["BIND_HOST"]
    workers = app.config["WORKERS"]
    subprocess.run([
        "gunicorn",
        "--workers",
        str(workers),
        "--pid",
        "/run/pbench-server/gunicorn.pid",
        "--bind",
        f"{str(host)}:{str(port)}",
        "pbench.server.api:create_app()",
    ])
Exemplo n.º 6
0
#!/bin/env python3

from pbench.server.api import create_app

if __name__ == "__main__":
    app = create_app()
    app.run(debug=True, port=app.config["PORT"])