예제 #1
0
 def test_capture_exception(self, logger, buffer):
     with mail.CaptureLogs(logger, buffer):
         try:
             0 / 0
         except Exception as error:
             logger.exception(error)
     assert 'ERROR:test:division by zero' in buffer.getvalue()
예제 #2
0
def refresh():
    """Update incremental aggregates and materialized views, then email logs
    to the development team.
    """
    buffer = io.StringIO()
    with mail.CaptureLogs(manage.logger, buffer):
        try:
            manage.update_aggregates()
            manage.refresh_materialized()
            download.clear_bucket()
        except Exception as error:
            manage.logger.exception(error)
    try:
        mail.send_mail(buffer)
    except Exception as error:
        logger.exception(error)
예제 #3
0
파일: refresh.py 프로젝트: gbinal/openFEC
def refresh():
    """Update incremental aggregates and materialized views, then email logs
    to the development team.
    """
    buffer = io.StringIO()
    with mail.CaptureLogs(manage.logger, buffer):
        try:
            manage.update_aggregates()
            manage.refresh_materialized()
            download.clear_bucket()
            legal_docs.index_advisory_opinions()
            legal_docs.load_advisory_opinions_into_s3()
            # TODO: needs to work with celery
            # legal_docs.load_current_murs()
        except Exception as error:
            manage.logger.exception(error)
    try:
        mail.send_mail(buffer)
    except Exception as error:
        logger.exception(error)
예제 #4
0
 def test_capture_logs(self, logger, buffer):
     with mail.CaptureLogs(logger, buffer):
         logger.info('beep')
     assert 'INFO:test:beep' in buffer.getvalue()