auto_test_package throws error even though test_package passes

164 Views Asked by At

I'm trying to write tests for an R package using testthat. Both testthat and devtools are installed using install_github, test code is in tests/testthat and test-all.R is in tests. using R CMD check I get

  • checking tests ... Running ‘test-all.R’ OK

and

>test()
Testing FASTIN
Loading FASTIN
IO test : ......

similarly

> test_package('FASTIN')
IO test : ......

Very pleased with my first testthat experience, I now wanted to auto-monitor further development with `auto_test_package', but calling 9it from the package root dir gives:

>auto_test_package('./')
IO test : ......
Error in digest(path, file = TRUE) : The specified pathname is not a file: /Users/phil/Work/FASTIN-R/FASTIN-R/tests/testthat

I guess this means that the tests run but something goes wrong once they're done? Trying to set this up manually with auto_test gives the same error:

>auto_test('./R/', './tests/')
IO test : ......
Error in digest(path, file = TRUE) : The specified pathname is not a file: /Users/phil/Work/FASTIN-R/FASTIN-R/tests/testthat

I tried setting auto_test up to use test/testthat instead, but this time the tests are run but throws errors as well...

auto_test('./R/','./tests/testthat/')
IO test : 12
1. Error: SI import works correctly ------------------------------------------------------------------------------------------
nchar(SI.predators) > 0 & nchar(SI.preys) > 0 is not TRUE
1: addSI(SI.predators = SI.predators, SI.preys = SI.preys, Frac.Coeffs.mean = Frac.Coeffs.mean, Frac.Coeffs.var = Frac.Coeffs.var) at test_io.R:10
2: stopifnot(nchar(SI.predators) > 0 & nchar(SI.preys) > 0) at /Users/phil/Work/FASTIN-R/FASTIN-R/R/DataIO.R:56
3: stop(sprintf(ngettext(length(r), "%s is not TRUE", "%s are not all TRUE"), ch), call. = FALSE, domain = NA)

What am I doing wrong here? I'm a bit puzzled and haven't found an immediate answer in the testthat code on github...

any help would be much appreciated! cheers

0

There are 0 best solutions below