Skip to content
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
Closed

skip_on_oldrel() #571

lionel- opened this issue Feb 7, 2017 · 8 comments

Comments

@lionel-
Copy link
Member

@lionel- 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
Copy link
Member

@hadley 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
Copy link
Contributor

@gaborcsardi 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-
Copy link
Member Author

@lionel- 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
Copy link
Member

@hadley 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
Copy link
Collaborator

@kevinushey 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
Copy link
Member

@hadley 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
Copy link
Member

@hadley 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
Copy link
Contributor

@gaborcsardi 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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.