Home / Function/ test_app_tearing_down_with_unhandled_exception() — flask Function Reference

test_app_tearing_down_with_unhandled_exception() — flask Function Reference

Architecture documentation for the test_app_tearing_down_with_unhandled_exception() function in test_appctx.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  10f40925_a0f0_4efe_aec0_b4cc9f7845b7["test_app_tearing_down_with_unhandled_exception()"]
  64d09782_9311_5dea_7886_5faca96ebc84["test_appctx.py"]
  10f40925_a0f0_4efe_aec0_b4cc9f7845b7 -->|defined in| 64d09782_9311_5dea_7886_5faca96ebc84
  style 10f40925_a0f0_4efe_aec0_b4cc9f7845b7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_appctx.py lines 113–133

def test_app_tearing_down_with_unhandled_exception(app, client):
    app.config["PROPAGATE_EXCEPTIONS"] = True
    cleanup_stuff = []

    @app.teardown_appcontext
    def cleanup(exception):
        cleanup_stuff.append(exception)

    @app.route("/")
    def index():
        raise ValueError("dummy")

    with pytest.raises(ValueError, match="dummy"):
        with app.app_context():
            client.get("/")

    assert len(cleanup_stuff) == 2
    assert isinstance(cleanup_stuff[0], ValueError)
    assert str(cleanup_stuff[0]) == "dummy"
    # exception propagated, seen by request context and with block context
    assert cleanup_stuff[0] is cleanup_stuff[1]

Subdomains

Frequently Asked Questions

What does test_app_tearing_down_with_unhandled_exception() do?
test_app_tearing_down_with_unhandled_exception() is a function in the flask codebase, defined in tests/test_appctx.py.
Where is test_app_tearing_down_with_unhandled_exception() defined?
test_app_tearing_down_with_unhandled_exception() is defined in tests/test_appctx.py at line 113.

Analyze Your Own Codebase

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

Try Supermodel Free