Skip to content
Myr

test_subclassing.py

This file

Path

tests/test_subclassing.py

33 lines · 698 bytes · Python

Last changed by

Merge pull request #3270 from pallets/metadataDavid Lordbefore adoption31d3c7e

History of this file

Take it

1# -*- coding: utf-8 -*-2"""3    tests.subclassing4    ~~~~~~~~~~~~~~~~~56    Test that certain behavior of flask can be customized by7    subclasses.89    :copyright: 2010 Pallets10    :license: BSD-3-Clause11"""1213import flask1415from 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__)2526    @app.route('/')27    def index():28        raise Exception('test')2930    rv = app.test_client().get('/', errors_stream=out)31    assert rv.status_code == 50032    assert b'Internal Server Error' in rv.data33    assert not out.getvalue()