def METHOD_NAME(tmpdir):
    # Raise user errors if __exit__ fails.
    path = create_lvm_conf(tmpdir, "")
    def fail():
        raise RuntimeError
    class UserError(Exception):
        pass
    with pytest.raises(UserError):
        with lvmconf.LVMConfig(path) as conf:
            conf.close = fail
            raise UserError