Skip to content

Commit

Permalink
Ensure tests are properly skipped without internet
Browse files Browse the repository at this point in the history
  • Loading branch information
jimhester committed Jul 20, 2020
1 parent 8907ac3 commit 7b63f78
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/testthat/test-deps.R
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,9 @@ test_that("dev_package_deps works with package using remotes", {
})

test_that("dev_package_deps can retrieve custom fields", {
skip_on_cran()
skip_if_offline()

res <- dev_package_deps(test_path("withremotes"), dependencies = "Config/Needs/pkgdown")

is_pkgdown <- "pkgdown" == res$package
Expand Down
15 changes: 15 additions & 0 deletions tests/testthat/test-system_requirements.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ test_that("system_requirements errors curl is not found", {
})

test_that("system_requirements returns an empty character vector if a package has no system requirements", {
skip_on_cran()
skip_if_offline()

pkg <- tempfile()
dir.create(pkg)
on.exit(unlink(pkg, recursive = TRUE))
Expand All @@ -50,6 +53,9 @@ test_that("system_requirements returns an empty character vector if a package ha
})

test_that("system requirements return the system requirements if it has a direct system requirement", {
skip_on_cran()
skip_if_offline()

pkg <- tempfile()
dir.create(pkg)
on.exit(unlink(pkg, recursive = TRUE))
Expand All @@ -68,6 +74,9 @@ test_that("system requirements return the system requirements if it has a direct
})

test_that("system_requirements return the system requirements if it has a hard dependency with a system requirement", {
skip_on_cran()
skip_if_offline()

pkg <- tempfile()
dir.create(pkg)
on.exit(unlink(pkg, recursive = TRUE))
Expand All @@ -90,6 +99,9 @@ test_that("system_requirements return the system requirements if it has a hard d
})

test_that("system_requirements return the system requirements if it has a soft dependency with a system requirement", {
skip_on_cran()
skip_if_offline()

pkg <- tempfile()
dir.create(pkg)
on.exit(unlink(pkg, recursive = TRUE))
Expand All @@ -112,6 +124,9 @@ test_that("system_requirements return the system requirements if it has a soft d
})

test_that("system_requirements return the system requirements if 2nd order dependencies have system requirements", {
skip_on_cran()
skip_if_offline()

pkg <- tempfile()
dir.create(pkg)
on.exit(unlink(pkg, recursive = TRUE))
Expand Down

0 comments on commit 7b63f78

Please sign in to comment.