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)
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)