()
| 39 | |
| 40 | @pytest.fixture(name=class="st">"async_app") |
| 41 | def _async_app(): |
| 42 | app = Flask(__name__) |
| 43 | |
| 44 | @app.route(class="st">"/", methods=[class="st">"GET", class="st">"POST"]) |
| 45 | @app.route(class="st">"/home", methods=[class="st">"GET", class="st">"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 class="st">"", 412 |
| 53 | |
| 54 | @app.route(class="st">"/error") |
| 55 | async def error(): |
| 56 | raise AppError() |
| 57 | |
| 58 | blueprint = Blueprint(class="st">"bp", __name__) |
| 59 | |
| 60 | @blueprint.route(class="st">"/", methods=[class="st">"GET", class="st">"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 class="st">"", 412 |
| 68 | |
| 69 | @blueprint.route(class="st">"/error") |
| 70 | async def bp_error(): |
| 71 | raise BlueprintError() |
| 72 | |
| 73 | app.register_blueprint(blueprint, url_prefix=class="st">"/bp") |
| 74 | |
| 75 | app.add_url_rule(class="st">"/view", view_func=AsyncView.as_view(class="st">"view")) |
| 76 | app.add_url_rule(class="st">"/methodview", view_func=AsyncMethodView.as_view(class="st">"methodview")) |
| 77 | |
| 78 | return app |
| 79 | |
| 80 | |
| 81 | @pytest.mark.parametrize(class="st">"path", [class="st">"/", class="st">"/home", class="st">"/bp/", class="st">"/view", class="st">"/methodview"]) |
nothing calls this directly
no test coverage detected