MCPcopy Create free account
hub / github.com/pallets/flask / test_teardown_request_handler

Function test_teardown_request_handler

tests/test_basic.py:748–763  ·  view source on GitHub ↗
(app, client)

Source from the content-addressed store, hash-verified

746
747
748def test_teardown_request_handler(app, client):
749 called = []
750
751 @app.teardown_request
752 def teardown_request(exc):
753 called.append(True)
754 return "Ignored"
755
756 @app.route("/")
757 def root():
758 return "Response"
759
760 rv = client.get("/")
761 assert rv.status_code == 200
762 assert b"Response" in rv.data
763 assert len(called) == 1
764
765
766def test_teardown_request_handler_debug_mode(app, client):

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected