Skip tests on CRAN, but run locally

后端 未结 2 956
陌清茗
陌清茗 2021-02-06 01:09

It there an easy way to skip the execution of some tests in a package if the package is tested by CRAN? The background is, I like to have a lot of tests and in sum they are time

2条回答
  •  感情败类
    2021-02-06 01:43

    Use an environment variable, like testthat does:

    skip_on_cran <- function() {
      if (identical(Sys.getenv("NOT_CRAN"), "true")) {
        return(invisible(TRUE))
      }
    
      skip("On CRAN")
    }
    

提交回复
热议问题