flask/tests/test_subclassing.py
David Lord 66b1b752da
simplify logging configuration
single default handler and formatter
don't remove handlers
configure level once using setLevel
document logging
reorganize logging tests
2017-07-31 12:49:03 -07:00

33 lines
735 B
Python

# -*- coding: utf-8 -*-
"""
tests.subclassing
~~~~~~~~~~~~~~~~~
Test that certain behavior of flask can be customized by
subclasses.
:copyright: (c) 2015 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import flask
from flask._compat import StringIO
def test_suppressed_exception_logging():
class SuppressedFlask(flask.Flask):
def log_exception(self, exc_info):
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()