def test_enable():
    logger = StdoutLogger(buffer_length=1)
    logger.open()

    logger.enable()
    assert logger.is_enabled()
    logger.record(['test'])
    assert len(logger._buffer) == 1
def test_enable():
    logger = StdoutLogger(buffer_length=1)
    with pytest.warns(DeprecationWarning):
        logger.open()

    logger.enable()
    assert logger.is_enabled()
    logger.record(['test'])
    assert len(logger._buffer) == 1
Exemplo n.º 3
0
def test_flush():
    logger = StdoutLogger(buffer_length=5)
    logger.enable()
    logger.record(['test'])
    assert len(logger._buffer) == 1
    logger.flush()
    assert len(logger._buffer) == 0
    logger.record(['test']*5)
    assert len(logger._buffer) == 5
    logger.record(['test'])
    assert len(logger._buffer) == 0
Exemplo n.º 4
0
def test_record():
    logger = StdoutLogger(buffer_length=1)
    logger.enable()
    logger.record(['test'])
    assert logger._buffer[0] == 'Record: test'