[R-pkg-devel] how to skip tests on CRAN but NOT on travis-ci?

Duncan Murdoch murdoch.duncan at gmail.com
Sun Jun 21 18:09:17 CEST 2015

On 21/06/2015 10:46 AM, Jennifer Bryan wrote:
> I hope this is an appropriate to place to ask this. My question involves add-on tools and services, but I think they are in common use and others might have same question.
> I am using testthat for testing and Travis (https://travis-ci.org) for continuous integration.
> I do not want the vast majority of my tests to run on CRAN. They take a long time, require an internet connection, etc. I believe the official testthat solution for this is to use testthat::skip_on_cran() at the beginning of the body of the test.
> However, I DO want these tests to run on Travis. In fact, I'd like to be as crazy strict on Travis as possible. More strict than on CRAN. So running R CMD check on Travis "as CRAN" is no good for me.
> I think this coincides with this unanswered question on stackoverflow:
> http://stackoverflow.com/questions/27557150/check-as-cran-but-do-not-skip-any-tests?lq=1
> Thanks for any suggestions,

Hi Jenny.

Besides the other suggestions, you can put tests in directories other
than "tests".  By default they won't run, but

R CMD check --test-dir=travisTests

will run them.  So if you can tell travis to add that option to the
command line, you could put all the travis-specific tests into
inst/travisTests, and it will run them instead of the regular ones.

Duncan Murdoch

More information about the R-package-devel mailing list