flask/tests/test_subclassing.py
pgjones d8262aa58c Pass the request ctx rather than use the globals in the app
The globals have a performance penalty which can be justified for the
convinience in user code. In the app however the ctx can easily be
passed through the method calls thereby reducing the performance
penalty.

This may affect extensions if they have subclassed the app and
overridden these methods.
2023-08-27 10:18:08 +01:00

21 lines
480 B
Python

from io import StringIO
import flask
def test_suppressed_exception_logging():
class SuppressedFlask(flask.Flask):
def log_exception(self, exc_info, ctx):
pass
out = StringIO()
app = SuppressedFlask(__name__)
@app.route("/")
def index():
raise Exception("test")
rv = app.test_client().get("/", errors_stream=out)
assert rv.status_code == 500
assert b"Internal Server Error" in rv.data
assert not out.getvalue()