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

Dirk Eddelbuettel edd @ending from debi@n@org
Sat Sep 8 20:06:16 CEST 2018


On 7 September 2018 at 13:08, Gábor Csárdi wrote:
| On Fri, Sep 7, 2018 at 12:29 PM Dirk Eddelbuettel <edd using debian.org> wrote:
| >
| >
| > On 7 September 2018 at 09:27, Gábor Csárdi wrote:
| > | When are users running tests for packages at all? The tests are by default
| > | no even installed with the package. The only time I usually do this is when
| >
| > Which some people consider to be the wrong decision by testthat.
| 
| How is testthat related to this? When you `R CMD INSTALL` a package,
| AFAICT it does not install the test by default. Independently of what
| testsuite you use.
| 
| > Base R has a set of functions
| >
| >    tools::testInstalledBasic
| >    tools::testInstalledPackage
| >    tools::testInstalledPackages
| >
| > so that an _installed_ package can be tested.  Unless, of course, it uses
| > testthat.  Matt Dowle just run into this (per a question on StackOverflow).
| > RUnit, on the other hand, supports this.
| 
| I am probably missing sg, but is this expected to run the Rcpp test suite?
| 
| tools::testInstalledPackage("Rcpp", types = "tests")
| 
| Because it takes 1ms to run and has no output.

When you set up a test runner it all works just as intended, and has for a
decade or so (see below for a demo of timeDate by the late Diethelm Wuertz).

I feel rather strongly that this is in fact an area where we as a community
failed to elevate our best practices. But as the cheesy saying goes: "The
best time to plant a tree was 20 years ago. The second best time is now."

Dirk


Demo below runs off the _installed_ package which is a rather neat feature we
could stress more for more complete regression and rev.dep tests.


R> library(RUnit)     ## needed to run all tests
R> ts <- defineTestSuite(name="timeDate", dirs=system.file("unitTests", package="timeDate")) 
R> library(timeDate)  ## needed for code to be tested and its Depends
R> res <- runTestSuite(ts)


Executing test function test.asDate  ... GMT
[1] [2006-06-01] [2006-12-01]
[1] "2006-06-01" "2006-12-01"
NewYork
[1] [2006-06-01] [2006-12-01]
[1] "2006-06-01" "2006-12-01"
 done successfully.


[... lots omitted as RUnit is verbose ...]

Executing test function test.AAA  ... [1] "Pacific/Auckland"
 done successfully.

R> res
Number of test functions: 56 
Number of errors: 1 
Number of failures: 0 
R>  

| 
| Gabor
| 
| [...]

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org



More information about the R-package-devel mailing list