tinytest icon indicating copy to clipboard operation
tinytest copied to clipboard

testdir not assuming folder is in installed directory `inst`

Open LiNk-NY opened this issue 1 year ago • 1 comments

Hi Mark, @markvanderloo

Happy New Year! I hope you are doing well.

In Bioconductor, we run longtests for packages that require extensive testing. For this we add a longtests directory in the base package directory and include tinytest.R inside the folder. See an example repository here: https://github.com/waldronlab/TENxIO

The documentation for test_package says that testdir should be the path to the installed directory, i.e., 'tinytest' by default.

For longtests, I have included an inst/longtests folder with test files BUT

tinytest::test_package("TENxIO", testdir = "longtests")

does not see this folder:

> tinytest::test_package("TENxIO", testdir = "longtests")
All ok, 0 results (0ms)
Warning message:
In structure(unlist(test_output, recursive = FALSE), class = "tinytests",  :
  Calling 'structure(NULL, *)' is deprecated, as NULL cannot have attributes.
  Consider 'structure(list(), *)' instead.

even after installing the package:

dir(system.file(package = "TENxIO", "longtests"))
[1] "test_TENxH5.R"

However, using inst/longtests does seem to work.

tinytest::test_package("TENxIO", testdir = "inst/longtests")

I didn't look any deeper but it seems that https://github.com/markvanderloo/tinytest/blob/2c23eb9a297f2268a40fcf4ab3f2455e4ee3e19f/pkg/R/tinytest.R#L860 may have something to do with it as it returns character(0) when dir is longtests (possibly because it is looking in the wrong folder?).

Thank you!

LiNk-NY avatar Jan 19 '23 20:01 LiNk-NY

Thanks for this. Will look into that!

markvanderloo avatar Jan 23 '23 20:01 markvanderloo