[R-pkg-devel] Submission to CRAN when package needs personal data (API key)

Gábor Csárdi c@@rdi@g@bor @ending from gm@il@com
Sat Sep 8 21:47:43 CEST 2018


On Fri, Sep 7, 2018 at 2:53 PM Iñaki Ucar <iucar using fedoraproject.org> wrote:
[...]
> For the record, this is what the testthat paper in the R Journal says:
>
> "[...] I recommend storing your tests in inst/tests/ (so users also
> have access to them), then including one file in tests/ that runs all
> of the package tests. The test_package(package_name) function makes
> this easy. [...] This setup has the additional advantage that users
> can make sure your package works correctly in their run-time
> environment."

And while deprecated, this method still works just fine, and will
continue to work.
You can just put your tests in inst/tests/testthat and put

withr::with_dir(
         system.file(package = <package>, "tests"),
         testthat::test_check(<package>))

in tests/testthat.R. And of course you can run the tests of the
installed package with
the same piece of code.

Gabor

> Iñaki
>
> >
> > Dirk
> >
> > --
> > http://dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org
> >



More information about the R-package-devel mailing list