Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JOSS Review] Add helper-data.R to tests/testthat #14

Closed
fawda123 opened this issue Mar 11, 2024 · 1 comment
Closed

[JOSS Review] Add helper-data.R to tests/testthat #14

fawda123 opened this issue Mar 11, 2024 · 1 comment

Comments

@fawda123
Copy link

fawda123 commented Mar 11, 2024

There are several objects that are duplicated across test files. You can define global objects used in each test file by adding them to helper-data.R. For example, this code is repeated in a lot of the files:

copy_lsn_to_temp()
temp_path <- paste0(tempdir(), "/MiddleFork04.ssn")
mf04p <- ssn_import(
    temp_path,
    predpts = c("pred1km", "CapeHorn", "Knapp"),
    overwrite = TRUE
  )

Adding it to helper-data.R ensures it's only created once and will reduce the time needed when the tests are run. You can also load any packages in this file that are used in more than one test file.

openjournals/joss-reviews#6389

@michaeldumelle
Copy link
Collaborator

michaeldumelle commented Apr 8, 2024

Thanks @fawda123; this is a great suggestion that will be so helpful in my other software packages too! Incorporated in this commit (on the develop branch).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants