Skip to content

Commit

Permalink
set lifecycle_verbosity = "quiet" for recipes varying tests (#102)
Browse files Browse the repository at this point in the history
* set lifecycle_verbosity = "quiet" for recipes varying tests

* add withr to DESCRIPTION file
  • Loading branch information
EmilHvitfeldt authored Nov 8, 2023
1 parent 9aedd35 commit 1085be5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ Suggests:
tibble,
tidyr,
tune,
withr,
workflows,
workflowsets,
xgboost,
Expand Down
5 changes: 5 additions & 0 deletions tests/testthat/test-recipes-varying.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
library(testthat)
library(tidymodels)

withr::local_options(lifecycle_verbosity = "quiet")

rec_1 <- recipe(mpg ~ ., mtcars) %>%
step_center(all_predictors()) %>%
step_impute_knn(all_predictors(), neighbors = varying()) %>%
Expand All @@ -14,6 +16,7 @@ rec_2 <- recipe(mpg ~ ., mtcars) %>%
rec_3 <- recipe(mpg ~ ., mtcars)

test_that('recipe parameters', {
withr::local_options(lifecycle_verbosity = "quiet")

# un-randomify the id names
rec_1_id <- rec_1
Expand Down Expand Up @@ -57,6 +60,7 @@ test_that('recipe parameters', {
})

test_that("recipe steps with non-varying args error if specified as varying()", {
withr::local_options(lifecycle_verbosity = "quiet")

rec_bad_varying <- rec_1
rec_bad_varying$steps[[1]]$skip <- varying()
Expand All @@ -68,6 +72,7 @@ test_that("recipe steps with non-varying args error if specified as varying()",
})

test_that("`full = FALSE` returns only varying arguments", {
withr::local_options(lifecycle_verbosity = "quiet")

x_spec <- rand_forest(min_n = varying()) %>%
set_engine("ranger", sample.fraction = varying())
Expand Down

0 comments on commit 1085be5

Please sign in to comment.