[R-pkg-devel] Skipping tests on CRAN
Thanks everyone! I'd like to follow the Duncan's approach but I am not sure if it solves the issue: * if I put the private tests into a separate folder and ignore it when building the package, then I still cannot run these checks without creating the tarball (Maintainer, Author not built into DESCRIPTION) * If I do not ignore this folder and build it into a tarball, then both private and public tests work, but now check-as-cran complains about non-standard directories. I do not see an option like --do-not-test-description which would skip the issues with authors and maintainers. Obviously, I can replicate authors both in @R and plain format but then again, what is the point of @R format? So for now I'll probably go with the Dirk's suggestion to default to "few tests" and set up an environment variable just for myself. BTW, Mark, I really like your tinytest vignettes :-) I should maybe move my tests over to this one day. Best, Ott
On Wed, Apr 21, 2021 at 3:03 AM Sebastian Meyer <seb.meyer at fau.de> wrote:
Am 21.04.21 um 08:35 schrieb Mark van der Loo:
Hi Ott, There is no documented way to detect whether you are running on CRAN. So there is nothing to rely on, on that side. You can only make your own machine detectable by the test code. For
example
by setting an environment variable that identifies your machine and make test execution depend on the value of that environment variable. This is what tinytest does under the hood.
You could add the following at the start of a script containing slow tests:
if (!identical(Sys.getenv("NOT_CRAN"), "true")) {
message("skipping slow tests")
q("no")
}
## slow tests follow here ...
Of course, you could use a different name for the environment variable,
e.g., "R_PKGNAME_ALL_TESTS", or test with as.logical() to allow both
"TRUE" and "true" values:
if (!isTRUE(as.logical(Sys.getenv("R_PKGNAME_ALL_TESTS")))) q("no")
Quitting from test scripts as above is frequently used in R's own test
suite, for example in the regression tests for message translations:
if (!capabilities("NLS")) {
message("no natural language support")
q("no")
}
Don't run such code in an interactive session if you don't want to quit
R. ;)
An alternative is the R CMD check --test-dir=inst/slowTests approach
mentioned in the WRE manual at
https://CRAN.R-project.org/doc/manuals/r-devel/R-exts.html#Checking-packages
.
Best regards,
Sebastian
Best, Mark On Wed, Apr 21, 2021 at 7:17 AM Ott Toomet <otoomet at gmail.com> wrote:
Hi packagers, what is the best way to skip certain tests on CRAN? So far I have
included
certain test files in .Rbuildignore and run the tests on the package directory. But now when moving to Authors at R format, I get errors about missing maintainer etc. I know there are options in testthat, tinytest and such, are these the
best
options with least dependencies and assumptions built in?
I sort of remember something in base R but cannot find anything when
looking for it now.
Cheers,
Ott
[[alternative HTML version deleted]]
______________________________________________ R-package-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
[[alternative HTML version deleted]]
______________________________________________ R-package-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel