RMI-PACTA / resources

This is a place to explore and share resources. Check out the "Issues".
https://rmi-pacta.github.io/resources/
17 stars 5 forks source link

Skip a test on check() but not test() #293

Open maurolepore opened 2 years ago

maurolepore commented 2 years ago

Saving this here to make it more discoverable -- I found it hard to find that R CMD check sets the environment var "R_CMD".

skip_if_R_CMD_check <- function() {
  if (!nzchar(Sys.getenv("R_CMD"))) {
    return(invisible(TRUE))
  }

  skip("Not run in R CMD check")
}

https://github.com/2DegreesInvesting/PACTA_analysis/blob/master/R/skip_if_R_CMD_check.R

Thanks @cjyetman cc' @MirijaHa

cjyetman commented 2 years ago

LOL.... agreed, that was not easy for me to discover!