PredictiveEcology / SpaDES

R package for developing and running Spatial Discrete Event Simulation models
https://spades.predictiveecology.org
Other
55 stars 21 forks source link

change in cache function #328

Closed MelinaHoule closed 7 years ago

MelinaHoule commented 7 years ago

Hi! This is my first pull request. Hope I didn't create a bug anywhere. I added 3 functionalities to the cache function (sideEffect, makeCopy and quick). I change the url. The file to download in the example is 4Mo. To run cache, use cache.test.R in the R directory (next to cache.R).

To discuss: -For now makeCopy only work the first time cache is running. I could add it to make it able to run inside the if (nrow(isInRepo) > 0).

achubaty commented 7 years ago

this PR has failed all the checks on appveyor and travis. @MelinaHoule can you please run R CMD check locally on your machine to confirm that it passes, making any fixes as necessary?

achubaty commented 7 years ago

the cache test should be in the tests directory and the file should be named test-cache.R, and use the appropriate testthat structure. because of the download (which is big!), this test should be skipped on cran.

achubaty commented 7 years ago

the tests are currently failing because the cache test function is being parsed into the package before the file definining simInit.

per my previous note, this unit test for cache modification should be included with the appropriate testthat structure so it is run only when testing the package rather than being a function in the package namespace.

after resolving this issue, you are also likely to see failures related to documentation/function mismatches, because you did not update the Rmd help files with you last set of commits. In Rstudio, make sure devtools is installed and do Ctrl + Shift + D (or run document()). If you are using the Rstudio project then it should automaically be configured to redocument things when you do an R CMD check.

achubaty commented 7 years ago

Closing for now as this is not ready, and there have been several changes made to caching since this PR was initiated. Feel free to start a new PR once you have updated your code and run the requisite checks.