diff --git a/tests/testthat/project-MASS/MASS.R b/tests/testthat/project-MASS/MASS.R deleted file mode 100644 index 09972541..00000000 --- a/tests/testthat/project-MASS/MASS.R +++ /dev/null @@ -1 +0,0 @@ -library(MASS) diff --git a/tests/testthat/test-bundlePackage.R b/tests/testthat/test-bundlePackage.R index 140bc1e7..1d321fdc 100644 --- a/tests/testthat/test-bundlePackage.R +++ b/tests/testthat/test-bundlePackage.R @@ -1,4 +1,7 @@ test_that("can snapshot deps with renv", { + skip_if_not_installed("foreign") + skip_if_not_installed("MASS") + app_dir <- local_temp_app(list(foo.R = "library(foreign); library(MASS)")) expect_snapshot(pkgs <- bundlePackages(app_dir)) @@ -13,6 +16,9 @@ test_that("can snapshot deps with renv", { }) test_that("can snapshot deps with packrat (option)", { + skip_if_not_installed("foreign") + skip_if_not_installed("MASS") + withr::local_options(rsconnect.packrat = TRUE) app_dir <- local_temp_app(list(foo.R = "library(foreign); library(MASS)")) @@ -28,6 +34,9 @@ test_that("can snapshot deps with packrat (option)", { }) test_that("can snapshot deps with packrat (env var)", { + skip_if_not_installed("foreign") + skip_if_not_installed("MASS") + withr::local_envvar(RSCONNECT_PACKRAT = "TRUE") app_dir <- local_temp_app(list(foo.R = "library(foreign); library(MASS)")) @@ -43,6 +52,9 @@ test_that("can snapshot deps with packrat (env var)", { }) test_that("can capture deps from renv lockfile", { + skip_if_not_installed("foreign") + skip_if_not_installed("MASS") + withr::local_options(renv.verbose = FALSE) app_dir <- local_temp_app(list(foo.R = "library(foreign); library(MASS)")) @@ -60,6 +72,9 @@ test_that("can capture deps from renv lockfile", { }) test_that("can capture deps with packrat even when renv lockfile present", { + skip_if_not_installed("foreign") + skip_if_not_installed("MASS") + withr::local_envvar(RSCONNECT_PACKRAT = "TRUE") withr::local_options(renv.verbose = FALSE) diff --git a/tests/testthat/test-bundlePackagePackrat.R b/tests/testthat/test-bundlePackagePackrat.R index e8411d1d..b427347a 100644 --- a/tests/testthat/test-bundlePackagePackrat.R +++ b/tests/testthat/test-bundlePackagePackrat.R @@ -27,6 +27,7 @@ test_that("uninstalled packages error", { }) test_that("recommended packages are snapshotted", { + skip_if_not_installed("MASS") app <- local_temp_app(list("index.Rmd" = c( "```{r}", "library(MASS)", diff --git a/tests/testthat/test-bundlePackageRenv.R b/tests/testthat/test-bundlePackageRenv.R index 49453afe..73eaf5a1 100644 --- a/tests/testthat/test-bundlePackageRenv.R +++ b/tests/testthat/test-bundlePackageRenv.R @@ -18,6 +18,8 @@ test_that("manifest has correct data types", { test_that("recommended packages are snapshotted", { skip_on_cran() + skip_if_not_installed("MASS") + withr::local_options(renv.verbose = TRUE) app <- local_temp_app(list("index.Rmd" = c( "```{r}", @@ -30,6 +32,8 @@ test_that("recommended packages are snapshotted", { test_that("extra packages are snapshotted", { skip_on_cran() + skip_if_not_installed("foreign") + withr::local_options(renv.verbose = TRUE) app <- local_temp_app(list("index.Rmd" = "")) deps <- snapshotRenvDependencies(app, extraPackages = c("foreign")) @@ -39,6 +43,7 @@ test_that("extra packages are snapshotted", { test_that("works with BioC packages", { skip_on_cran() skip_on_ci() + app <- local_temp_app(list("index.R" = c( "library(Biobase)" ))) @@ -68,6 +73,8 @@ test_that("works with BioC packages", { # https://github.com/rstudio/rsconnect/issues/968 test_that("large directories are analyzed", { skip_on_cran() + skip_if_not_installed("foreign") + app_dir <- local_temp_app(list("foo.R" = "library(foreign)")) data_dir <- file.path(app_dir, "data") dir.create(data_dir) @@ -83,6 +90,9 @@ test_that("large directories are analyzed", { # parseRenvDependencies --------------------------------------------------- test_that("gets DESCRIPTION from renv & system libraries", { + skip_if_not_installed("foreign") + skip_if_not_installed("MASS") + withr::local_options(renv.verbose = FALSE) app_dir <- local_temp_app(list("foo.R" = "library(foreign); library(MASS)")) @@ -98,6 +108,9 @@ test_that("gets DESCRIPTION from renv & system libraries", { test_that("errors if library and project are inconsistent", { + skip_if_not_installed("foreign") + skip_if_not_installed("MASS") + withr::local_options(renv.verbose = FALSE) app_dir <- local_temp_app(list("foo.R" = "library(foreign); library(MASS)")) diff --git a/tests/testthat/test-writeManifest.R b/tests/testthat/test-writeManifest.R index b9ac440b..dc0662d1 100644 --- a/tests/testthat/test-writeManifest.R +++ b/tests/testthat/test-writeManifest.R @@ -9,6 +9,8 @@ makeManifest <- function(appDir, appPrimaryDoc = NULL, ...) { test_that("renv.lock is included for renv projects", { skip_on_cran() + skip_if_not_installed("foreign") + skip_if_not_installed("MASS") withr::local_options(renv.verbose = FALSE) @@ -23,6 +25,8 @@ test_that("renv.lock is included for renv projects", { test_that("renv.lock is not included for non-renv projects", { skip_on_cran() + skip_if_not_installed("foreign") + skip_if_not_installed("MASS") withr::local_options(renv.verbose = FALSE)