simplify logging configuration
single default handler and formatter don't remove handlers configure level once using setLevel document logging reorganize logging tests
This commit is contained in:
parent
85fa8aabf5
commit
66b1b752da
13 changed files with 399 additions and 451 deletions
|
|
@ -9,8 +9,8 @@
|
|||
:copyright: (c) 2015 by Armin Ronacher.
|
||||
:license: BSD, see LICENSE for more details.
|
||||
"""
|
||||
|
||||
import flask
|
||||
from logging import StreamHandler
|
||||
|
||||
from flask._compat import StringIO
|
||||
|
||||
|
|
@ -22,16 +22,12 @@ def test_suppressed_exception_logging():
|
|||
|
||||
out = StringIO()
|
||||
app = SuppressedFlask(__name__)
|
||||
app.logger_name = 'flask_tests/test_suppressed_exception_logging'
|
||||
app.logger.addHandler(StreamHandler(out))
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
1 // 0
|
||||
raise Exception('test')
|
||||
|
||||
rv = app.test_client().get('/')
|
||||
rv = app.test_client().get('/', errors_stream=out)
|
||||
assert rv.status_code == 500
|
||||
assert b'Internal Server Error' in rv.data
|
||||
|
||||
err = out.getvalue()
|
||||
assert err == ''
|
||||
assert not out.getvalue()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue