-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- `dqrng` updates (see #96); - be more careful setting seeds in tests; - restored some previously failing tests; - misc formatting/cleanup.
- Loading branch information
Showing
9 changed files
with
183 additions
and
213 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,8 +12,8 @@ Description: Provides GIS and map utilities, plus additional modeling tools for | |
URL: | ||
https://spades-tools.predictiveecology.org, | ||
https://github.com/PredictiveEcology/SpaDES.tools | ||
Date: 2024-04-25 | ||
Version: 2.0.6.9000 | ||
Date: 2024-05-13 | ||
Version: 2.0.6.9001 | ||
Authors@R: c( | ||
person("Eliot J B", "McIntire", , "[email protected]", role = c("aut"), | ||
comment = c(ORCID = "0000-0002-6914-8316")), | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
rastDF <- data.frame(pkg = c("raster", "terra"), | ||
class = c("Raster", "SpatRaster"), | ||
read = c("raster::raster", "terra::rast"), | ||
stack = c("raster::stack", "terra::rast"), | ||
stackClass = c("RasterStack", "SpatRaster"), | ||
extent = c("raster::extent", "terra::ext")) | ||
|
||
needTerraAndRaster <- function(envir = parent.frame()) { | ||
rastDF <- data.frame( | ||
pkg = c("raster", "terra"), | ||
class = c("Raster", "SpatRaster"), | ||
read = c("raster::raster", "terra::rast"), | ||
stack = c("raster::stack", "terra::rast"), | ||
stackClass = c("RasterStack", "SpatRaster"), | ||
extent = c("raster::extent", "terra::ext") | ||
) | ||
|
||
if (!requireNamespace("raster", quietly = TRUE)) { | ||
rastDF <- rastDF[rastDF$pkg == "terra", ] | ||
} | ||
|
@@ -18,17 +20,12 @@ needTerraAndRaster <- function(envir = parent.frame()) { | |
# optsAsk in this environment, | ||
# loads and libraries indicated plus testthat, | ||
# sets options("reproducible.ask" = FALSE) if ask = FALSE | ||
testInit <- function(libraries = character(), ask = FALSE, verbose, | ||
tmpFileExt = "", | ||
opts = NULL, needGoogleDriveAuth = FALSE | ||
) { | ||
testInit <- function(libraries = character(), ask = FALSE, verbose, tmpFileExt = "", opts = NULL) { | ||
data.table::setDTthreads(2) | ||
reproducible::set.randomseed() | ||
|
||
pf <- parent.frame() | ||
|
||
if (isTRUE(needGoogleDriveAuth)) | ||
libraries <- c(libraries) | ||
if (length(libraries)) { | ||
libraries <- unique(libraries) | ||
loadedAlready <- vapply(libraries, function(pkg) | ||
|
@@ -44,56 +41,35 @@ testInit <- function(libraries = character(), ask = FALSE, verbose, | |
} | ||
} | ||
|
||
# skip_gauth <- identical(Sys.getenv("SKIP_GAUTH"), "true") # only set in setup.R for covr | ||
# if (isTRUE(needGoogleDriveAuth) ) { | ||
# if (!skip_gauth) { | ||
# if (interactive()) { | ||
# if (!googledrive::drive_has_token()) { | ||
# getAuth <- FALSE | ||
# if (is.null(getOption("gargle_oauth_email"))) { | ||
# possLocalCache <- "c:/Eliot/.secret" | ||
# cache <- if (file.exists(possLocalCache)) | ||
# possLocalCache else TRUE | ||
# switch(Sys.info()["user"], | ||
# emcintir = {options(gargle_oauth_email = "[email protected]", | ||
# gargle_oauth_cache = cache)}, | ||
# NULL) | ||
# } | ||
# if (is.null(getOption("gargle_oauth_email"))) { | ||
# if (.isRstudioServer()) { | ||
# .requireNamespace("httr", stopOnFALSE = TRUE) | ||
# options(httr_oob_default = TRUE) | ||
# } | ||
# } | ||
# getAuth <- TRUE | ||
# if (isTRUE(getAuth)) | ||
# googledrive::drive_auth() | ||
# } | ||
# } | ||
# } | ||
# skip_if_no_token() | ||
# } | ||
|
||
out <- list() | ||
withr::local_options("reproducible.ask" = ask, .local_envir = pf) | ||
# withr::local_options("spades.debug" = debug, .local_envir = pf) | ||
# withr::local_options("spades.moduleCodeChecks" = smcc, .local_envir = pf) | ||
withr::local_options("spades.recoveryMode" = FALSE, .local_envir = pf) | ||
withr::local_options("reproducible.verbose" = FALSE, .local_envir = pf) | ||
withr::local_options("spades.useRequire" = FALSE, .local_envir = pf) | ||
withr::local_options("spades.sessionInfo" = FALSE, .local_envir = pf) | ||
|
||
if (!missing(verbose)) | ||
## set default options for tests | ||
withr::local_options(list( | ||
reproducible.ask = ask, | ||
reproducible.verbose = FALSE, | ||
# spades.debug = debug, | ||
# spades.moduleCodeChecks = smcc, | ||
spades.sessionInfo = FALSE, | ||
spades.recoveryMode = FALSE, | ||
spades.useRequire = FALSE | ||
), .local_envir = pf) | ||
|
||
if (!missing(verbose)) { | ||
withr::local_options("reproducible.verbose" = verbose, .local_envir = pf) | ||
if (!is.null(opts)) | ||
} | ||
if (!is.null(opts)) { | ||
withr::local_options(opts, .local_envir = pf) | ||
tmpdir <- reproducible::normPath(withr::local_tempdir(tmpdir = reproducible::tempdir2(), .local_envir = pf)) | ||
tmpCache <- reproducible::normPath(withr::local_tempdir(tmpdir = tmpdir, .local_envir = pf)) | ||
} | ||
tmpdir <- withr::local_tempdir(tmpdir = reproducible::tempdir2(), .local_envir = pf) |> | ||
reproducible::normPath() | ||
tmpCache <- withr::local_tempdir(tmpdir = tmpdir, .local_envir = pf) |> | ||
reproducible::normPath() | ||
if (isTRUE(any(nzchar(tmpFileExt)))) { | ||
dotStart <- startsWith(tmpFileExt, ".") | ||
if (any(!dotStart)) | ||
tmpFileExt[!dotStart] <- paste0(".", tmpFileExt) | ||
out$tmpfile <- reproducible::normPath(withr::local_tempfile(tmpdir = tmpdir, fileext = tmpFileExt)) | ||
out$tmpfile <- withr::local_tempfile(tmpdir = tmpdir, fileext = tmpFileExt) |> | ||
reproducible::normPath() | ||
} | ||
withr::local_dir(tmpdir, .local_envir = pf) | ||
|
||
|
Oops, something went wrong.