New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skip_on_oldrel() #571

Closed
lionel- opened this Issue Feb 7, 2017 · 8 comments

Comments

Projects
None yet
4 participants
@lionel-
Member

lionel- commented Feb 7, 2017

To skip tests on old R releases:

skip_on_oldrel <- function(version, msg = NULL) {
  if (utils::packageVersion("base") < version) {
    msg <- msg %||% paste("R version too old:", version)
    skip(msg)
  }
}
@hadley

This comment has been minimized.

Member

hadley commented Oct 1, 2017

I think we should generalise this to:

skip_on_r_version("= 3.1")
skip_on_r_version(">= 3.1")

etc

@gaborcsardi

This comment has been minimized.

Member

gaborcsardi commented Oct 2, 2017

skip_on_r_version("==", "3.1")
skip_on_r_version("<=", "3.1")

etc. is easier to implement (no parsing needed) , and just as easy to write, and it is also easier to write programmatically. I think.

@lionel-

This comment has been minimized.

Member

lionel- commented Oct 2, 2017

Good idea. Going further, making it a functional would be even easier to implement, more flexible (it'd accept arbitrary comparison functions which could handle edge cases more easily) and more idiomatic for R:

skip_on_r_version(`==`, "3.1")
skip_on_r_version(my_predicate, "3.1")
@hadley

This comment has been minimized.

Member

hadley commented Oct 2, 2017

@lionel- only a limited number of operators have been implemented for working with version objects, so I'd rather keep it simple for now

@kevinushey

This comment has been minimized.

Collaborator

kevinushey commented Oct 2, 2017

What about just punting to a more general skip_if, e.g.

skip_if(getRversion() == "3.1.0")

The skip_on_r_version() signature seems easy to get wrong as a user.

@hadley

This comment has been minimized.

Member

hadley commented Oct 2, 2017

The advantage of a more specific method is a better message, but skip_if() seems worthwhile even if we do have skip_on_r_version().

@hadley

This comment has been minimized.

Member

hadley commented Oct 2, 2017

Comparing these options:

skip_if(getRversion() == "3.1.0")
skip_on_r_version(`==`, "3.1.0")

I don't think the more specific skip is any more appealing.

@hadley hadley closed this in 8d31918 Oct 2, 2017

@gaborcsardi

This comment has been minimized.

Member

gaborcsardi commented Oct 2, 2017

Maybe the message would be nicer for the second one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment