I am using testthat
to write unit tests for my R packages. I have seen a few package authors (like those from Rcpp
and ggplot2
) distributing their unit tests with the binary files.
However, when I build my packages with RStudio (0.98.1102) and devtools
(1.7.0) the tests
folder is not included in the zip file. Do I have to add the folder manually or is it possible to get this done automatically by setting some option?
BTW: I am on a Win7 machine using R v3.1.2 and RTools v3.1.0.1942.
Binary Packages. The binary format of an R package is useful because an R user can install a binary package without compiling all of the package's source code. In some cases source packages can take hours to install. Additionally, compiling package binaries requires locating and installing system prerequisites.
extdata: Extra data used to calculate ID numbers in Yassai et al.'s nomenclature.
If you're using RStudio, press Cmd/Ctrl + Shift + T (or run devtools::test() if not) to run all the tests in a package.
Rbuildignore is a Perl-compatible regular expression that is matched, without regard to case, against the path to each file in the source package 1. If the regular expression matches, that file or directory is excluded.
Got it.
Found the information on the github page of testthat
(it's at the very bottom).
https://github.com/hadley/testthat
The advantage of this new structure is that the user has control over whether or not tests are installed using the --install-tests parameter to R CMD install, or INSTALL_opts = "--install-tests" argument to install.packages(). I'm not sure why you wouldn't want to install the tests, but now you have the option.
The command to build the binary package WITH the tests is
devtools::build(binary=TRUE, args=c("--preclean", "--install-tests"))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With