'This checks whether Flask can write errors sanely.
https://github.com/Miserlou/Zappa/issues/283'

def test_flask_logging_bug(self):

    event = {'body': {}, 'headers': {}, 'pathParameters': {}, 'path': '/', 'httpMethod': 'GET', 'queryStringParameters': {}, 'requestContext': {}}
    old_stderr = sys.stderr
    sys.stderr = BytesIO()
    try:
        environ = create_wsgi_request(event)
        app = flask.Flask(__name__)
        with app.request_context(environ):
            app.logger.error(u'This    is    a    test')
            log_output = sys.stderr.getvalue()
            if (sys.version_info[0] < 3):
                self.assertNotIn("'str'    object    has    no    attribute    'write'", log_output)
                self.assertNotIn('Logged    from    file    tests.py', log_output)
    finally:
        sys.stderr = old_stderr
