show warning for old logger config

This commit is contained in:
David Lord 2019-07-02 11:32:28 -07:00
parent 017ed6a37c
commit e8b8fcbfd4
3 changed files with 41 additions and 3 deletions

View file

@ -104,3 +104,12 @@ def test_log_view_exception(app, client):
err = stream.getvalue()
assert "Exception on / [GET]" in err
assert "Exception: test" in err
def test_warn_old_config(app, request):
old_logger = logging.getLogger("flask.app")
old_logger.setLevel(logging.DEBUG)
request.addfinalizer(lambda: old_logger.setLevel(logging.NOTSET))
with pytest.warns(UserWarning):
assert app.logger.getEffectiveLevel() == logging.WARNING