def pytest_configure():
    logging.basicConfig(format='%(message)s')
    logging.getLogger('sqlalchemy.engine').setLevel(logging.WARNING)

    class Shorten(logging.Filter):
        max_len = 500

        def filter(self, record):
            if (record.msg == '%r'):
                record.msg = (record.msg % record.args)
                record.args = ()
            if (len(record.msg) > self.max_len):
                record.msg = (record.msg[:self.max_len] + '...')
            return True
    logging.getLogger('sqlalchemy.engine.base.Engine').addFilter(Shorten())
def pytest_configure():
    logging.basicConfig(format='%(message)s')
    logging.getLogger('sqlalchemy.engine').setLevel(logging.WARNING)

    class Shorten(logging.Filter):
        max_len = 500

        def filter(self, record):
            if (record.msg == '%r'):
                record.msg = (record.msg % record.args)
                record.args = ()
            if (len(record.msg) > self.max_len):
                record.msg = (record.msg[:self.max_len] + '...')
            return True
    logging.getLogger('sqlalchemy.engine.base.Engine').addFilter(Shorten())