Skip to content

Commit 67ca3bb

Browse files
committed
Only skip if _R_CHECK_FORCE_SUGGESTS_ is false
1 parent 1b12bf7 commit 67ca3bb

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/testthat/helper.R

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,21 @@ local_helpers <- function(helpers, .local_envir = parent.frame()) {
144144
gitcreds$git_run(c("config", "--global", "--add", "credential.helper", helper))
145145
}
146146
}
147+
148+
isFALSE <- function(x) {
149+
is.logical(x) && length(x) == 1L && !is.na(x) && !x
150+
}
151+
152+
is_false_check_env_var <- function(x, default = "") {
153+
# like utils:::str2logical
154+
val <- Sys.getenv(x, default)
155+
if (isFALSE(as.logical(val))) return(TRUE)
156+
tolower(val) %in% c("0", "no")
157+
}
158+
159+
# Only skip if _R_CHECK_FORCE_SUGGESTS_ is false
160+
161+
skip_if_not_installed <- function(pkg) {
162+
if (!is_false_check_env_var("_R_CHECK_FORCE_SUGGESTS_")) return()
163+
testthat::skip_if_not_installed(pkg)
164+
}

0 commit comments

Comments
 (0)