From 7b63f78c3fb2830d6feba5c73d5017bcf19de23b Mon Sep 17 00:00:00 2001 From: Jim Hester Date: Mon, 20 Jul 2020 11:38:25 -0400 Subject: [PATCH] Ensure tests are properly skipped without internet --- tests/testthat/test-deps.R | 3 +++ tests/testthat/test-system_requirements.R | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/tests/testthat/test-deps.R b/tests/testthat/test-deps.R index fe61ce5d..4779f3c2 100644 --- a/tests/testthat/test-deps.R +++ b/tests/testthat/test-deps.R @@ -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 diff --git a/tests/testthat/test-system_requirements.R b/tests/testthat/test-system_requirements.R index 2baed8ea..8ab596ec 100644 --- a/tests/testthat/test-system_requirements.R +++ b/tests/testthat/test-system_requirements.R @@ -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)) @@ -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)) @@ -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)) @@ -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)) @@ -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))