2020-04-03 18:33:40 -07:00
|
|
|
from io import StringIO
|
|
|
|
|
|
2011-09-05 18:52:28 +02:00
|
|
|
import flask
|
|
|
|
|
|
|
|
|
|
|
2014-09-03 20:50:54 +02:00
|
|
|
def test_suppressed_exception_logging():
|
|
|
|
|
class SuppressedFlask(flask.Flask):
|
|
|
|
|
def log_exception(self, exc_info):
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
out = StringIO()
|
|
|
|
|
app = SuppressedFlask(__name__)
|
|
|
|
|
|
2019-05-06 15:39:41 -04:00
|
|
|
@app.route("/")
|
2014-09-03 20:50:54 +02:00
|
|
|
def index():
|
2019-05-06 15:39:41 -04:00
|
|
|
raise Exception("test")
|
2014-09-03 20:50:54 +02:00
|
|
|
|
2019-05-06 15:39:41 -04:00
|
|
|
rv = app.test_client().get("/", errors_stream=out)
|
2014-09-03 20:50:54 +02:00
|
|
|
assert rv.status_code == 500
|
2019-05-06 15:39:41 -04:00
|
|
|
assert b"Internal Server Error" in rv.data
|
2017-07-28 14:55:52 -07:00
|
|
|
assert not out.getvalue()
|