[R-pkg-devel] Problem passing noSuggests test

Michael Chirico m|ch@e|ch|r|co4 @end|ng |rom gm@||@com
Fri Aug 1 16:39:42 CEST 2025


I would emphasize/paraphrase Ivan's point -- using goldens (.Rout.save) for
such tests is quite a headache. We do so for a very limited number of tests
in {data.table} (something like 10 tests of over 10,000).

You could instead change the tests of Suggests behavior to be based on
expectations, be that a framework like {testthat}/{RUnit}/{assertthat} or
just the built-in tooling like stopifnot(), where you just quit/skip the
checks when Suggests are unavailable.

Of course if you have a strong affinity for golden tests you can just split
things into multiple test files. If it is a huge pain to disentangle which
tests rely on Suggests behavior, that is a decent sign to me that maybe
that package is not Suggests after all.

Mike C

On Fri, Aug 1, 2025, 7:29 AM Sebastian Meyer <seb.meyer using fau.de> wrote:

> Am 31.07.25 um 11:09 schrieb Jon Olav Skoien:
> > Is there a different way of conditionally
> > using the suggested package? Or do I have to use the IGNORE_RDIFF
> > method?
>
> To use *reference output* for optional tests, you could move these tests
> to a dedicated script with a corresponding .Rout.save file, put the
> files in a tests/ subdirectory, and use an .Rin file to include them
> only if the suggested package is available. I implemented a similar
> approach in the 'nlme' package to run extra tests with reference output
> conditionally on an environment variable, see
> <https://svn.r-project.org/R-packages/trunk/nlme/tests/extras.Rin> for
> inspiration.
>
> --
> Sebastian Meyer
>
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel
>

	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list