Skip to content
Myr

test_subclassing.py

This file

Path

tests/test_subclassing.py

33 lines · 736 bytes · Python

Last changed by

Merge pull request #2624 from pallets/metadataDavid Lordbefore adoption4309c7c

History of this file

Take it

The walk stopped after 200 commits: lines older than d2a46dc point at it.

fix doc build errorDavid Lordbefore adoptiond2a46dc

lines 1–8why, one step back
1# -*- coding: utf-8 -*-
2"""3 tests.subclassing4 ~~~~~~~~~~~~~~~~~56 Test that certain behavior of flask can be customized by7 subclasses.8

Merge pull request #2624 from pallets/metadataDavid Lordbefore adoption4309c7c

line 9why, one step back
9 :copyright: © 2010 by the Pallets team.

fix doc build errorDavid Lordbefore adoptiond2a46dc

lines 10–11why, one step back
10 :license: BSD, see LICENSE for more details.
11"""

Merge pull request #2436 from davidism/loggingDavid Lordbefore adoptionc74f469

line 12why, one step back
12

fix doc build errorDavid Lordbefore adoptiond2a46dc

lines 13–27why, one step back
13import flask
1415from 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():

Merge pull request #2436 from davidism/loggingDavid Lordbefore adoptionc74f469

line 28why, one step back
28 raise Exception('test')

fix doc build errorDavid Lordbefore adoptiond2a46dc

line 29why, one step back
29

Merge pull request #2436 from davidism/loggingDavid Lordbefore adoptionc74f469

line 30why, one step back
30 rv = app.test_client().get('/', errors_stream=out)

fix doc build errorDavid Lordbefore adoptiond2a46dc

lines 31–32why, one step back
31 assert rv.status_code == 500
32 assert b'Internal Server Error' in rv.data

Merge pull request #2436 from davidism/loggingDavid Lordbefore adoptionc74f469

line 33why, one step back
33 assert not out.getvalue()