Skip to content

[R-pkg-devel] Problem passing noSuggests test

1 message · Ivan Krylov

#
? Thu, 31 Jul 2025 11:09:39 +0200
Jon Olav Skoien <jon.skoien at gmail.com> ?????:
Correct! (requireNamespace(...) is also a good option if you don't
intend to use the package directly and are instead testing your
package's internal use of its optional dependency.)
There may be no good solution for "reference output" tests when some of
their dependencies are optional. Without bringing in a test framework,
I've only seen kludges, such as the test printing reference output when
the optional dependency is missing:

https://github.com/Rdatatable/data.table/blob/8039a230b0ebbcc8ca9ea86e84d7c378e00b9d51/tests/knitr.R#L2-L3

I wouldn't call it a beautiful solution, but it does work.