diff --git a/NEWS.md b/NEWS.md index 649b6bc8b..cf50ee1b4 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # testthat (development version) +* `skip_if_offline()` now errors if you don't have curl installed (#1854). + * All packages, regardless of whether or not they use rlang 1.0.0, now use the new snapshot display for errors, warnings, and messages (#1856). diff --git a/R/skip.R b/R/skip.R index 46d6465d8..21fd36c7b 100644 --- a/R/skip.R +++ b/R/skip.R @@ -18,7 +18,8 @@ #' difficult to install. #' #' * `skip_if_offline()` skips if an internet connection is not available -#' (using [curl::nslookup()]) or if the test is run on CRAN. +#' (using [curl::nslookup()]) or if the test is run on CRAN. Requires +#' the curl packages to be installed. #' #' * `skip_if_translated("msg")` skips tests if the "msg" is translated. #' @@ -122,8 +123,9 @@ package_version <- function(x) { #' @export #' @rdname skip skip_if_offline <- function(host = "r-project.org") { + check_installed("curl") + skip_on_cran() - skip_if_not_installed("curl") skip_if_not(has_internet(host), "offline") } has_internet <- function(host) { diff --git a/man/skip.Rd b/man/skip.Rd index 34807a221..516e09b93 100644 --- a/man/skip.Rd +++ b/man/skip.Rd @@ -78,7 +78,8 @@ you can assume that suggested packages are installed, and you do not need to check for them specifically, unless they are particularly difficult to install. \item \code{skip_if_offline()} skips if an internet connection is not available -(using \code{\link[curl:nslookup]{curl::nslookup()}}) or if the test is run on CRAN. +(using \code{\link[curl:nslookup]{curl::nslookup()}}) or if the test is run on CRAN. Requires +the curl packages to be installed. \item \code{skip_if_translated("msg")} skips tests if the "msg" is translated. \item \code{skip_on_bioc()} skips on Bioconductor (using the \code{IS_BIOC_BUILD_MACHINE} env var).