What is the correct way to skip all tests in the test directory of package R when using the testthat / devtools framework? For example, if there is no connection to the database, and all the tests rely on this connection, do I need to write skip in all files separately or write one skip somewhere?
I have a standard package setting that looks like
MyPackage /
- ... # another package.
- Tests /
- testthat.R
- testthat /
- test thing1.R
- test thing2.R
At first it seemed to me that I could put the test in the testthat.R file, for example
## in testthat.R library(testthat) library(mypackage) fail_test <- function() FALSE if (fail_test()) test_check("package")
but this did not work, and it seems that the call to devtools::test() simply ignores this file. I guess the alternative would be to keep all the tests in a different directory, but is there a better solution?
source share