def test_write_last_good_git_revision_exception(context, mocker):
    def boom(*args):
        raise OSError("blah")

    mocker.patch.object(sgpg, "open", new=boom)
    with pytest.raises(OSError):
        sgpg.write_last_good_git_revision(context, "foo")
def test_last_good_git_revision_exists(context):
    try:
        sgpg.write_last_good_git_revision(context, "foo")
        assert sgpg.get_last_good_git_revision(context) == "foo"
    finally:
        os.remove(context.config['last_good_git_revision_file'])