()
| 39 | |
| 40 | @pytest.fixture(name="async_app") |
| 41 | def _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"]) |
nothing calls this directly
no test coverage detected
searching dependent graphs…