[R-pkg-devel] Handling Not-Always-Needed Dependencies? - Part 2

Duncan Murdoch murdoch.duncan at gmail.com
Thu Aug 4 18:48:17 CEST 2016


On 04/08/2016 11:46 AM, Paul Gilbert wrote:
> (One question from the thread Handling Not-Always-Needed Dependencies?)
>
> I hope not to start another long tangled thread, but I have a basic
> confusion which I think has a yes/no answer and I would like to know if
> there is agreement on this point (or is it only me that is confused as
> usual).
>
> 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?
>
> Yes or no:  ?
>
> (I realize my own answer might be different if the package was used in
> an example or demo in place of a test, but that is just the confusion
> caused by too many uses for Suggests. In the case of a test, my own
> thought is that the test must fail, so my own answer is no. If the test
> does not fail then there is no real testing being done, thus missing
> code coverage in the testing. If the answer is no, then the tests do not
> need to be run if the package is not available, because it is known that
> they must fail. I think that not bothering to run the tests because the
> result is known is even more efficient than other suggestions. I also
> think it is the status quo.)
>
> Hoping my confusion is cleared up, and this does not become another long
> tangled thread,

I'd say it's up to you as the author of the test.  Would skipping that 
test mean that your package was not adequately tested?  If so, then you 
should get an error if it isn't available, because otherwise people will 
think they've done adequate testing when they haven't.  One way this 
could happen if a major function of your package is being tested on a 
sample  dataset from a Suggested package.  Users of your package don't 
need the other one, but testers do.

Duncan Murdoch



More information about the R-package-devel mailing list