Home / File/ test_async.py — flask Source File

test_async.py — flask Source File

Architecture documentation for test_async.py, a python file in the flask codebase. 4 imports, 0 dependents.

File python ApplicationKernel AppRegistry 4 imports 4 functions 4 classes

Entity Profile

Dependency Diagram

graph LR
  c9cd1825_5294_5972_6259_dce477f8c5df["test_async.py"]
  aa18ff11_36d2_0529_71e8_5f32020424ef["asyncio"]
  c9cd1825_5294_5972_6259_dce477f8c5df --> aa18ff11_36d2_0529_71e8_5f32020424ef
  a3b6bf50_a08c_5b95_a565_66ac9c531a68["pytest"]
  c9cd1825_5294_5972_6259_dce477f8c5df --> a3b6bf50_a08c_5b95_a565_66ac9c531a68
  5780e981_47e0_b047_a10f_eacdf8d87fa7["flask"]
  c9cd1825_5294_5972_6259_dce477f8c5df --> 5780e981_47e0_b047_a10f_eacdf8d87fa7
  72990941_dca0_cf6b_2a9d_9ca828c45dd6["flask.views"]
  c9cd1825_5294_5972_6259_dce477f8c5df --> 72990941_dca0_cf6b_2a9d_9ca828c45dd6
  style c9cd1825_5294_5972_6259_dce477f8c5df fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import asyncio

import pytest

from flask import Blueprint
from flask import Flask
from flask import request
from flask.views import MethodView
from flask.views import View

pytest.importorskip("asgiref")


class AppError(Exception):
    pass


class BlueprintError(Exception):
    pass


class AsyncView(View):
    methods = ["GET", "POST"]

    async def dispatch_request(self):
        await asyncio.sleep(0)
        return request.method


class AsyncMethodView(MethodView):
    async def get(self):
        await asyncio.sleep(0)
        return "GET"

    async def post(self):
        await asyncio.sleep(0)
        return "POST"


@pytest.fixture(name="async_app")
def _async_app():
    app = Flask(__name__)

    @app.route("/", methods=["GET", "POST"])
    @app.route("/home", methods=["GET", "POST"])
    async def index():
        await asyncio.sleep(0)
        return request.method

    @app.errorhandler(AppError)
    async def handle(_):
        return "", 412

    @app.route("/error")
    async def error():
        raise AppError()

    blueprint = Blueprint("bp", __name__)

    @blueprint.route("/", methods=["GET", "POST"])
// ... (86 more lines)

Subdomains

Dependencies

  • asyncio
  • flask
  • flask.views
  • pytest

Frequently Asked Questions

What does test_async.py do?
test_async.py is a source file in the flask codebase, written in python. It belongs to the ApplicationKernel domain, AppRegistry subdomain.
What functions are defined in test_async.py?
test_async.py defines 4 function(s): _async_app, test_async_before_after_request, test_async_error_handler, test_async_route.
What does test_async.py depend on?
test_async.py imports 4 module(s): asyncio, flask, flask.views, pytest.
Where is test_async.py in the architecture?
test_async.py is located at tests/test_async.py (domain: ApplicationKernel, subdomain: AppRegistry, directory: tests).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free