Skip to content

skip_on_oldrel() #571

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

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

skip_on_oldrel() #571

lionel- opened this issue Feb 7, 2017 · 8 comments
Labels
expectation 🙀 feature a feature request or enhancement

Comments

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

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- 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 hadley added expectation 🙀 feature a feature request or enhancement labels Oct 2, 2017
@hadley
Copy link
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
Copy link
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
Copy link
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
Copy link
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 as completed in 8d31918 Oct 2, 2017
@gaborcsardi
Copy link
Member

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
Labels
expectation 🙀 feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

4 participants