skip_if_disconnected: Skip tests that need an internet connection if you don't have...

View source: R/offline.R

skip_if_disconnectedR Documentation

Skip tests that need an internet connection if you don't have one

Description

Temporary connection trouble shouldn't fail your build.

Usage

skip_if_disconnected(
  message = paste("Offline: cannot reach", url),
  url = "http://httpbin.org/"
)

Arguments

message

character message to be printed, passed to testthat::skip()

url

character URL to ping to check for a working connection

Details

Note that if you call this from inside one of the mock contexts, it will follow the mock's behavior. That is, inside with_fake_http(), the check will pass and the following tests will run, but inside without_internet(), the following tests will be skipped.

Value

If offline, a test skip; else invisibly returns TRUE.

See Also

testthat::skip()


nealrichardson/httptest documentation built on Feb. 5, 2024, 12:35 a.m.