flask/tests/test_subclassing.py

22 lines
475 B
Python
Raw Normal View History

2020-04-04 09:33:40 +08:00
from io import StringIO
import flask
2014-09-04 02:50:54 +08:00
def test_suppressed_exception_logging():
class SuppressedFlask(flask.Flask):
def log_exception(self, exc_info):
pass
out = StringIO()
app = SuppressedFlask(__name__)
@app.route("/")
2014-09-04 02:50:54 +08:00
def index():
raise Exception("test")
2014-09-04 02:50:54 +08:00
rv = app.test_client().get("/", errors_stream=out)
2014-09-04 02:50:54 +08:00
assert rv.status_code == 500
assert b"Internal Server Error" in rv.data
assert not out.getvalue()