Home / Function/ app() — flask Function Reference

app() — flask Function Reference

Architecture documentation for the app() function in conftest.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  2232843c_ffc3_829b_7a27_a694335d4c69["app()"]
  2f7e4e80_be3d_7829_3628_0cb296db6764["conftest.py"]
  2232843c_ffc3_829b_7a27_a694335d4c69 -->|defined in| 2f7e4e80_be3d_7829_3628_0cb296db6764
  style 2232843c_ffc3_829b_7a27_a694335d4c69 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

examples/tutorial/tests/conftest.py lines 16–32

def app():
    """Create and configure a new app instance for each test."""
    # create a temporary file to isolate the database for each test
    db_fd, db_path = tempfile.mkstemp()
    # create the app with common test config
    app = create_app({"TESTING": True, "DATABASE": db_path})

    # create the database and load test data
    with app.app_context():
        init_db()
        get_db().executescript(_data_sql)

    yield app

    # close and remove the temporary database
    os.close(db_fd)
    os.unlink(db_path)

Subdomains

Frequently Asked Questions

What does app() do?
app() is a function in the flask codebase, defined in examples/tutorial/tests/conftest.py.
Where is app() defined?
app() is defined in examples/tutorial/tests/conftest.py at line 16.

Analyze Your Own Codebase

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

Try Supermodel Free