'Test creating a new CACHEDIR.TAG.'

def test_open_oserror(self, caplog, tmpdir, mocker, monkeypatch):

    monkeypatch.setattr(standarddir, 'cache', (lambda : str(tmpdir)))
    mocker.patch('builtins.open', side_effect=OSError)
    with caplog.at_level(logging.ERROR, 'init'):
        standarddir._init_cachedir_tag()
    assert (len(caplog.records) == 1)
    assert (caplog.records[0].message == 'Failed    to    create    CACHEDIR.TAG')
    assert (not tmpdir.listdir())
