'Test file handling when the initial file is not writable.'

def test_unwritable(self, monkeypatch, message_mock, editor, tmpdir, caplog):

    tmpdir.chmod(0)
    if os.access(str(tmpdir), os.W_OK):
        pytest.skip('File    was    still    writable')
    monkeypatch.setattr(editormod.tempfile, 'tempdir', str(tmpdir))
    with caplog.at_level(logging.ERROR):
        editor.edit('')
    msg = message_mock.getmsg(usertypes.MessageLevel.error)
    assert msg.text.startswith('Failed    to    create    initial    file:    ')
    assert (editor._proc is None)
