[R-pkg-devel] Handling Not-Always-Needed Dependencies? - Part 2
Bill Denney
bill at denney.ws
Thu Aug 4 18:55:16 CEST 2016
On 8/4/2016 11:51 AM, Dirk Eddelbuettel wrote:
> On 4 August 2016 at 11:46, Paul Gilbert wrote:
> | If my package has a test that needs another package, but that package is
> | not needed in the /R code of my package, then I indicate it as
> | "Suggests", not as "Depends" nor as "Imports". If that package is not
> | available when I run R CMD check, should the test pass?
>
> Wrong question.
>
> Better question: Should the test be running? My preference is for only
> inside of a requireNamespace() (or equivalent) block as the package is not
> guaranteed to be present. In theory.
>
> In practice people seem to unconditionally install it anyway, and think that
> is a good idea. I disagree on both counts but remain in the vocal minority.
As another package maintainer, I had almost the identical question
reading the previous (long) thread, but the three answers here don't
give the same answer. My question I can make even more concrete:
I use the testthat package for my testing. I never use it in the R code
itself, and it is explicitly only used for testing. Should that be
included as "Depends" because every test requires it or "Suggests"
because no end user ever needs it?
If "Depends", then it leads to over-installation of the package by end
users who don't care about running tests locally. If "Suggests", then
all of the tests would fail (assuming that Dirk's suggestion is
implemented).
At a loss,
Bill
More information about the R-package-devel
mailing list