Home / Function/ test_aborting() — flask Function Reference

test_aborting() — flask Function Reference

Architecture documentation for the test_aborting() function in test_regression.py from the flask codebase.

Entity Profile

Dependency Diagram

graph TD
  ee424662_d954_7572_20bc_3f895ca2fcd5["test_aborting()"]
  70c8e8b8_6fab_0e4a_afdd_a41c9884cc17["test_regression.py"]
  ee424662_d954_7572_20bc_3f895ca2fcd5 -->|defined in| 70c8e8b8_6fab_0e4a_afdd_a41c9884cc17
  style ee424662_d954_7572_20bc_3f895ca2fcd5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_regression.py lines 4–30

def test_aborting(app):
    class Foo(Exception):
        whatever = 42

    @app.errorhandler(Foo)
    def handle_foo(e):
        return str(e.whatever)

    @app.route("/")
    def index():
        raise flask.abort(flask.redirect(flask.url_for("test")))

    @app.route("/test")
    def test():
        raise Foo()

    with app.test_client() as c:
        rv = c.get("/")
        location_parts = rv.headers["Location"].rpartition("/")

        if location_parts[0]:
            # For older Werkzeug that used absolute redirects.
            assert location_parts[0] == "http://localhost"

        assert location_parts[2] == "test"
        rv = c.get("/test")
        assert rv.data == b"42"

Subdomains

Frequently Asked Questions

What does test_aborting() do?
test_aborting() is a function in the flask codebase, defined in tests/test_regression.py.
Where is test_aborting() defined?
test_aborting() is defined in tests/test_regression.py at line 4.

Analyze Your Own Codebase

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

Try Supermodel Free