Include tests in R binary package
I use R testthat
to write unit tests for my packages. I have seen several package authors (e.g. from Rcpp
and ggplot2
) distributing their unit tests with binaries. However, when I build my packages with RStudio (0.98.1102) and devtools
(1.7.0), the folder is tests
not included in the zip file. Do I need to add the folder manually or can it be done automatically by setting some parameter?
BTW: I am on a Win7 machine using R v3.1.2 and RTools v3.1.0.1942.
source to share
Ha! Got it. Found information on the github page testthat
(it is at the very bottom).
https://github.com/hadley/testthat
The advantage of this new structure is that the user has control over whether tests are installed using the -install-tests option to install R CMD or INSTALL_opts = "--install-tests" to install.packages (). I'm not sure why you don't want to install tests, but now you have the option.
Command for building a binary package with tests
devtools::build(binary=TRUE,args=c("--preclean","--install-tests"))
source to share