[Rd] tests conditioned on CRAN?

Henrik Bengtsson hb at biostat.ucsf.edu
Mon Jul 1 10:31:24 CEST 2013


"On CRAN servers" or ""R CMD check --as-cran"?  I assume you mean the
former.  The way I do it is "the other way around", i.e. to condition
on running locally or not such that the default is not to run or to
run a smaller test case:

if (Sys.getenv("_R_CHECK_FULL_") == "") {
  # Default/no test
} else {
  # Full test
}

Note, _R_CHECK_FULL_ is inspired by the other _R_CHECK_*_ flags, but
it's not an official one.  Since the CRAN servers don't define
_R_CHECK_FULL_, you can be fairly sure this works as you want.  Making
assumptions on which flags CRAN use at any time/in the future is a
much harder task.

/Henrik


On Mon, Jul 1, 2013 at 7:28 AM, Spencer Graves
<spencer.graves at structuremonitoring.com> wrote:
> Hello:
>
>
>       What is the recommended procedure for skipping long tests in "R CMD
> check --as-cran"?
>
>
>       Some time ago, after a discussion on this list, I added the following
> function to the fda package:
>
>
> CRAN <- function (x = "_R_CHECK_TIMINGS_") {
>     x. <- Sys.getenv(x)
>     nchar(as.character(x.)) > 0
> }
>
>
>       However, it does not seem to be working with R 3.0.1.  I know this,
> because the time to compute the examples in findFn.Rd in the sos package did
> not drop after I wrapped all the examples in the following:
>
>
> if(!CRAN()){
>
> ...
>
> }
>
>
>       Thanks,
>       Spencer
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list