Пример #1
0
def test_premature_get_map():
    LOG_STREAM.truncate(0)
    LOG_STREAM.seek(0)
    ContextLog.clear()
    with pytest.raises(RuntimeError) as ex:
        ContextLog.get_map()
    assert "Don't call get_map before get_logger!" in str(ex.value)
Пример #2
0
def test_premature_put():
    LOG_STREAM.truncate(0)
    LOG_STREAM.seek(0)
    ContextLog.clear()
    with pytest.raises(RuntimeError) as excinfo:
        ContextLog.put_request_id('xyz')
    assert "Don't call put before get_logger!" in str(excinfo.value)