コード例 #1
0
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)
コード例 #2
0
ファイル: test_log.py プロジェクト: cpaulik/pyscaffold
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)
コード例 #3
0
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!'
コード例 #4
0
ファイル: test_log.py プロジェクト: cpaulik/pyscaffold
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!'
コード例 #5
0
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)
コード例 #6
0
ファイル: test_log.py プロジェクト: blue-yonder/pyscaffold
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
    )