Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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).

Expand Down
6 changes: 4 additions & 2 deletions R/skip.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#'
Expand Down Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion man/skip.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.