def test_colored_others_methods(caplog, reset_logger): # Given the logger is properly set, logging.getLogger(DEFAULT_LOGGER).setLevel(logging.DEBUG) logger.handler.setFormatter(ColoredReportFormatter()) # When conventional methods are called on logger, logger.debug('some-info!') # Then the message should be surrounded by ansi codes out = caplog.text assert ansi_regex('some-info!').search(out)
def test_colored_others_methods(caplog, reset_logger): # Given the logger is properly set, logging.getLogger(DEFAULT_LOGGER).setLevel(logging.DEBUG) logger.handler.setFormatter(ColoredReportFormatter()) # When conventional methods are called on logger, logger.debug('some-info!') # Then the message should be surrounded by ansi codes out = caplog.text assert ansi_regex('some-info!').search(out)
def test_other_methods(caplog, reset_logger): # Given the logger level is properly set, logging.getLogger(DEFAULT_LOGGER).setLevel(logging.DEBUG) # When conventional methods are called on logger, logger.debug('some-info!') # Then they should bypass `report`-specific formatting match = match_last_report(caplog) assert not match assert caplog.records[-1].levelno == logging.DEBUG assert caplog.records[-1].message == 'some-info!'
def test_other_methods(caplog, reset_logger): # Given the logger level is properly set, logging.getLogger(DEFAULT_LOGGER).setLevel(logging.DEBUG) # When conventional methods are called on logger, logger.debug('some-info!') # Then they should bypass `report`-specific formatting match = match_last_report(caplog) assert not match assert caplog.records[-1].levelno == logging.DEBUG assert caplog.records[-1].message == 'some-info!'
def test_other_methods(caplog): # Given the logger level is properly set, caplog.set_level(logging.DEBUG) name = uniqstr() # When conventional methods are called on logger, logger.debug(name) # Then they should bypass `report`-specific formatting assert all(not match_report(r, message=name) for r in caplog.records) assert any( match_record(r, levelno=logging.DEBUG, message=name) for r in caplog.records)
def test_other_methods(caplog): # Given the logger level is properly set, caplog.set_level(logging.DEBUG) name = uniqstr() # When conventional methods are called on logger, logger.debug(name) # Then they should bypass `report`-specific formatting assert all( not match_report(r, message=name) for r in caplog.records ) assert any( match_record(r, levelno=logging.DEBUG, message=name) for r in caplog.records )