def test_wsgi_errors_stream(app, client): @app.route("/") def index(): app.logger.error("test") return "" stream = StringIO() client.get("/", errors_stream=stream) assert "ERROR in test_logging: test" in stream.getvalue() assert wsgi_errors_stream._get_current_object() is sys.stderr with app.test_request_context(errors_stream=stream): assert wsgi_errors_stream._get_current_object() is stream
def test_wsgi_errors_stream(app, client): @app.route('/') def index(): app.logger.error('test') return '' stream = StringIO() client.get('/', errors_stream=stream) assert 'ERROR in test_logging: test' in stream.getvalue() assert wsgi_errors_stream._get_current_object() is sys.stderr with app.test_request_context(errors_stream=stream): assert wsgi_errors_stream._get_current_object() is stream