test_subclassing.py
This file
Path
tests/test_subclassing.py
37 lines · 865 bytes · Python
Last changed by
Merge pull request #1303 from Parkayun/masterMarkus Unterwaditzerbefore adoption5b98266
History of this fileTake it
1# -*- coding: utf-8 -*-2"""3 tests.subclassing4 ~~~~~~~~~~~~~~~~~56 Test that certain behavior of flask can be customized by7 subclasses.89 :copyright: (c) 2015 by Armin Ronacher.10 :license: BSD, see LICENSE for more details.11"""12import flask13from logging import StreamHandler1415from flask._compat import StringIO161718def test_suppressed_exception_logging():19 class SuppressedFlask(flask.Flask):20 def log_exception(self, exc_info):21 pass2223 out = StringIO()24 app = SuppressedFlask(__name__)25 app.logger_name = 'flask_tests/test_suppressed_exception_logging'26 app.logger.addHandler(StreamHandler(out))2728 @app.route('/')29 def index():30 1 // 03132 rv = app.test_client().get('/')33 assert rv.status_code == 50034 assert b'Internal Server Error' in rv.data3536 err = out.getvalue()37 assert err == ''