def test_already_exist(mock_makedirs, mock_isdir, caplog):
    mock_isdir.return_value = True
    mock_makedirs.side_effect = OSError(errno.EEXIST, 'already exist')
    with caplog.at_level((logging.DEBUG - 1)):
        mkdir_p('a/b')
    assert ([mock.call('a/b')] == mock_makedirs.call_args_list)
    assert (len(caplog.records) == 1)
    assert (caplog.records[0].levelno == (logging.DEBUG - 1))
    assert ('tried' in caplog.records[0].msg)
def test_already_exist(mock_makedirs, mock_isdir, caplog):
    mock_isdir.return_value = True
    mock_makedirs.side_effect = OSError(errno.EEXIST, 'already exist')
    with caplog.at_level((logging.DEBUG - 1)):
        mkdir_p('a/b')
    assert ([mock.call('a/b')] == mock_makedirs.call_args_list)
    assert (len(caplog.records) == 1)
    assert (caplog.records[0].levelno == (logging.DEBUG - 1))
    assert ('tried' in caplog.records[0].msg)