R CMD check (R 4.0.0) now runs \donttest: How to proceed with long-running examples?

From the NEWS of R 4.0.0:

R CMD check --as-cran now runs \donttest examples (which are run by example() ) instead of instructing the tester to do so. This can be temporarily circumvented during development by setting environment variable _R_CHECK_DONTTEST_EXAMPLES_ to a false value.

In my package, I have a few examples that take ca. 1-3 minutes to run. For me, it would be okay if CRAN would run these, but I am wondering whether long-running examples are now okay on CRAN. Or is there a drop-in replacement for \donttest? Furthermore, others might have examples that may run even longer ...

There is a related issue in the devtools repo: devtools::check() running examples with --run-donttest when run_dont_test = FALSE · Issue #2216 · r-lib/devtools · GitHub


@hplieninger Did you have any private response or other views on how to handle this? I use \donttest for examples that I would like to run to produce nice output for my pkgdown documentation; this often requires e.g. an access token for a remote service which may be present on my machine or as a secure environment variable on travis but will not be present on CRAN. This change kills that approach. I feel like I may end up having to patch the source code before submission to CRAN to convert \donttest to \dontrun.

1 Like

No, unfortunately not. Probably, the next option would be to ask on R-package-devel ...

I just encountered this. I had wrapped a long-running example in \dontrun and I got the response from CRAN:

examples wrapped in \donttest{} are not executed in the CRAN checks.
The - as cran check behaves in a different way and run checks including
\donttest{}, since most of this examples are only wrapped in \donttest
because of run time issues and the package maintainer should ensure that
all examples (including \donttest) are executable and behave as expected.
We do not run \donttest in the regular checks because we check thousands
of package every day.

So I tried to get clarification:

Just to clarify (so I can convey to other devs), on submission,
--run-donttest is run (and long-running examples may be observed and
noted), but regular checks (system stability and revdep checks)
\donttest is not run and will not be flagged?