[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: autodep8 for R packages?



> Hi,
> 
> On Wed, Mar 30, 2016 at 09:42:48PM -0500, Dirk Eddelbuettel wrote:
>> On 30 March 2016 at 23:16, Gordon Ball wrote:
>> | For the set of R packages I recently uploaded, I added trivial DEP-8
>> | tests* which did:
>> |
>> | R -e "if (! require('$pkg')) quit(status=1)"
>>
>> require() is deprecated. Use
>>
>> requireNamespace("$pkg", quietly=TRUE)
>>
>> which also returns a boolean. Or simply
>>
>> library("$pkg")
>>
>> which either dies, or proceeds in which case you can follow with q(status=1).

The test can just be `R -e "library('$pkg')"` (thanks for noticing I was
overcomplicating things), but the logic doesn't really change. I hadn't
heard anything about require() being deprecated (as opposed to advice
not to use it, particularly interactively).
> 
> I confirm that automatically creating tests makes sense but I think
> creating these simple ones is not that helpful since most R packages I
> dealt with recently are featuring more sophisticated tests using the
> available test suites in R.

My rationale for the "can be loaded" test was that it *should* be
universal, and should at least catch serious dependency breaks caused by
changes to other R packages and shared libraries. Subtle behaviour
changes are missed, but it at least cheaply gives you a warning when
packages become completely broken.

I thought about trying to generalise running the test/ directory (as R
CMD check does), but since the r-base-dev CDBS makefile doesn't run the
tests, their dependencies are not guaranteed to be installed or even
packaged. We could try and detect them from DESCRIPTION::Suggests and
guess the deb package names, but I suspect there would be lots of bad
edge cases.

> 
>> | Which I think is sufficient to trivially test whether a package has been
>> | properly installed with required dependencies and hence can be loaded by R.
>> |
>> | Would it be useful to try and get a rule to do this automatically into
>> | autodep8 (suggested by Mattia who sponsored my original uploads), and
>> | hence provide a minimal autopkgtest for all R packages? (Are there any
>> | corner cases in which this wouldn't work?)
>>
>> Not sure.
>> Pro: Additional test.
>> Con: Test is already done at package build time (ie R itself does this)
> 
> The "Con" part is no con at all. Running a test at build time is a
> different thing than autopkgtest. Please read the docs.
> 
> Kind regards
> 
> Andreas.


Reply to: