Skip to content

Commit

Permalink
apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
simonpcouch committed Sep 28, 2023
1 parent db27af9 commit d6b958f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions R/checks.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
}
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/checks.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-checks.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down

0 comments on commit d6b958f

Please sign in to comment.