R-Lum / Luminescence

Development of the R package 'Luminescence'
http://r-lum.github.io/Luminescence/
GNU General Public License v3.0
15 stars 7 forks source link

include the tests/testdata directory in the package #168

Closed mcol closed 1 month ago

mcol commented 1 month ago

The tests/testdata directory is currently listed in the .Rbuildignore file, presumably to keep the package size small. However, the listing of that directory shows that almost all files are less than 3K (the only exception being SPEfile.SPE at 275K), which is smaller than most of our R functions.

This has the downside that in test_read_BIN2R.R we must download those files from github with lots of calls like:

suppressWarnings(read_BIN2R(file = "https://github.com/R-Lum/Luminescence/raw/master/tests/testdata/BINfile_V3.bin",
                            txtProgressBar = FALSE))

I suggest adding testdata to the package, but excluding the SPEfile.SPE by listing it explicitly in .Rbuildignore. This will also allow the addition of a DRAC sample input (3.6K) for tests, and with that the package will increase by 32K at most.

RLumSK commented 1 month ago

What about using the package vcr for this?

mcol commented 1 month ago

That will add a Suggests dependency and it seems overkill as we are not trying to test http request as such, just trying to read some files that we also have locally (but CI won't have because they are not packaged).

That's not a big deal, I could leave things as they are and also download the DRAC input from github.

RLumSK commented 1 month ago

Agreed, then proceed with your original suggestion.

mcol commented 1 month ago

In order to make those files visible during tests, I'll move them from tests/testdata to tests/testthat/data, that seems the only way to make tests run reliably.