MCPcopy
hub / github.com/pallets/flask / _async_app

Function _async_app

tests/test_async.py:41–78  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

39
40@pytest.fixture(name="async_app")
41def _async_app():
42 app = Flask(__name__)
43
44 @app.route("/", methods=["GET", "POST"])
45 @app.route("/home", methods=["GET", "POST"])
46 async def index():
47 await asyncio.sleep(0)
48 return request.method
49
50 @app.errorhandler(AppError)
51 async def handle(_):
52 return "", 412
53
54 @app.route("/error")
55 async def error():
56 raise AppError()
57
58 blueprint = Blueprint("bp", __name__)
59
60 @blueprint.route("/", methods=["GET", "POST"])
61 async def bp_index():
62 await asyncio.sleep(0)
63 return request.method
64
65 @blueprint.errorhandler(BlueprintError)
66 async def bp_handle(_):
67 return "", 412
68
69 @blueprint.route("/error")
70 async def bp_error():
71 raise BlueprintError()
72
73 app.register_blueprint(blueprint, url_prefix="/bp")
74
75 app.add_url_rule("/view", view_func=AsyncView.as_view("view"))
76 app.add_url_rule("/methodview", view_func=AsyncMethodView.as_view("methodview"))
77
78 return app
79
80
81@pytest.mark.parametrize("path", ["/", "/home", "/bp/", "/view", "/methodview"])

Callers

nothing calls this directly

Calls 5

FlaskClass · 0.90
BlueprintClass · 0.90
as_viewMethod · 0.80
register_blueprintMethod · 0.45
add_url_ruleMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…