diff --git a/R/checks.R b/R/checks.R index 28dfcddb3..0d0e00f4c 100644 --- a/R/checks.R +++ b/R/checks.R @@ -201,11 +201,10 @@ check_installs <- function(x, call = caller_env()) { if (length(deps) > 0) { is_inst <- purrr::map_lgl(deps, is_installed) if (any(!is_inst)) { - deps_not_installed <- deps[!is_inst] - deps_not_installed <- deps_not_installed[!duplicated(deps_not_installed)] + needs_installed <- unique(deps[!is_inst]) cli::cli_abort( - "{cli::qty(deps_not_installed)} Package install{?s} {?is/are} \\ - required for {.pkg {deps_not_installed}}.", + "{cli::qty(needs_installed)} Package install{?s} {?is/are} \\ + required for {.pkg {needs_installed}}.", call = call ) } diff --git a/tests/testthat/_snaps/checks.md b/tests/testthat/_snaps/checks.md index 7030ea19e..45721a50d 100644 --- a/tests/testthat/_snaps/checks.md +++ b/tests/testthat/_snaps/checks.md @@ -84,7 +84,7 @@ Error in `tune:::check_workflow()`: ! A parsnip model is required. -# errors informatively with needed package install +# errors informatively when needed package isn't installed Code check_workflow(stan_wflow) diff --git a/tests/testthat/test-checks.R b/tests/testthat/test-checks.R index 7d4f73aa9..f1d8e6762 100644 --- a/tests/testthat/test-checks.R +++ b/tests/testthat/test-checks.R @@ -179,7 +179,7 @@ test_that("workflow objects", { }) }) -test_that("errors informatively with needed package install", { +test_that("errors informatively when needed package isn't installed", { # rstanarm is not installed during CI runs # in contexts where it _is_ installed, skip the test. skip_if(rlang::is_installed("rstanarm"))