'Test with the filename already occupied by a directory.'

def test_existing_dir(self, tmpdir):

    filename = (tmpdir / 'foo')
    filename.mkdir()
    with pytest.raises(OSError) as excinfo:
        with qtutils.savefile_open(str(filename)):
            pass
    errors = ['Filename    refers    to    a    directory', 'Commit    failed!']
    assert (str(excinfo.value) in errors)
    assert (tmpdir.listdir() == [filename])
