diff --git a/tests/testthat/test-butcher-recipes.R b/tests/testthat/test-butcher-recipes.R index 2d5b958..543e82a 100644 --- a/tests/testthat/test-butcher-recipes.R +++ b/tests/testthat/test-butcher-recipes.R @@ -15,7 +15,7 @@ terms_empty_env <- function(axed, step_number) { } test_that("recipe + step_nnmf_sparse + axe_env() works", { - skip_if(utils::packageVersion("recipes") < "0.1.17.9001") + skip_if_not_installed("recipes", "0.1.17.9001") rec <- recipe(HHV ~ ., data = biomass_tr) %>% step_nnmf_sparse(all_numeric_predictors(), num_comp = 2, seed = 473) x <- axe_env(rec) @@ -23,7 +23,7 @@ test_that("recipe + step_nnmf_sparse + axe_env() works", { }) test_that("recipe + step_nnmf_sparse + bake() works", { - skip_if(utils::packageVersion("recipes") < "0.1.17.9001") + skip_if_not_installed("recipes", "0.1.17.9001") rec <- recipe(HHV ~ ., data = biomass_tr) %>% step_nnmf_sparse(all_numeric_predictors(), num_comp = 2, seed = 473) %>% prep() diff --git a/tests/testthat/test-parsnip-extension-messaging.R b/tests/testthat/test-parsnip-extension-messaging.R index 1306834..81450fc 100644 --- a/tests/testthat/test-parsnip-extension-messaging.R +++ b/tests/testthat/test-parsnip-extension-messaging.R @@ -1,5 +1,5 @@ test_that('messaging with unknown implementation (bag tree, tidymodels/parsnip#793)', { - skip_if(utils::packageVersion("parsnip") < "1.0.2") + skip_if_not_installed("parsnip", "1.0.2") library(parsnip) @@ -68,7 +68,7 @@ test_that('messaging with unknown implementation (bag tree, tidymodels/parsnip#7 }) test_that('messaging with unknown implementation (decision tree, tidymodels/parsnip#793)', { - skip_if(utils::packageVersion("parsnip") < "1.0.2") + skip_if_not_installed("parsnip", "1.0.2") library(parsnip) @@ -136,7 +136,7 @@ test_that('missing implementation checks prompt conservatively with old objects # extension packages, as well as model specs generated before parsnip 1.0.2, # will not have this slot. ensure that these messages/errors aren't # erroneously introduced when that's the case - skip_if(utils::packageVersion("parsnip") < "1.0.2") + skip_if_not_installed("parsnip", "1.0.2") library(parsnip) @@ -159,7 +159,7 @@ test_that('missing implementation checks prompt conservatively with old objects test_that('missing implementation checks prompt conservatively with old objects (decision_tree)', { # see comment in above chunk - skip_if(utils::packageVersion("parsnip") < "1.0.2") + skip_if_not_installed("parsnip", "1.0.2") library(parsnip) @@ -190,7 +190,7 @@ test_that('missing implementation checks prompt conservatively with old objects test_that('missing implementation checks prompt conservatively with external objects (arima_boost)', { # see comment in above chunk - skip_if(utils::packageVersion("parsnip") < "1.0.2") + skip_if_not_installed("parsnip", "1.0.2") library(modeltime) diff --git a/tests/testthat/test-recipes-nnmf_sparse.R b/tests/testthat/test-recipes-nnmf_sparse.R index c3247b5..5d16bb5 100644 --- a/tests/testthat/test-recipes-nnmf_sparse.R +++ b/tests/testthat/test-recipes-nnmf_sparse.R @@ -3,7 +3,7 @@ library(recipes) suppressPackageStartupMessages(library(Matrix)) # Waiting for fix in RcppML test_that('Correct values', { - skip_if(utils::packageVersion("recipes") < "0.1.17.9001") + skip_if_not_installed("recipes", "0.1.17.9001") rec <- recipe(Species ~ ., data = iris) %>% step_nnmf_sparse(all_predictors(), seed = 2432) @@ -30,7 +30,7 @@ test_that('Correct values', { }) test_that('No NNF', { - skip_if(utils::packageVersion("recipes") < "0.1.17.9001") + skip_if_not_installed("recipes", "0.1.17.9001") rec <- recipe(Species ~ ., data = iris) %>% step_nnmf_sparse(all_predictors(), seed = 2432, num_comp = 0) %>% @@ -46,7 +46,7 @@ test_that('No NNF', { }) test_that('tunable', { - skip_if(utils::packageVersion("recipes") < "0.1.17.9001") + skip_if_not_installed("recipes", "0.1.17.9001") rec <- recipe(~., data = iris) %>% step_nnmf_sparse(all_predictors()) @@ -62,7 +62,7 @@ test_that('tunable', { }) test_that('keep_original_cols works', { - skip_if(utils::packageVersion("recipes") < "0.1.17.9001") + skip_if_not_installed("recipes", "0.1.17.9001") rec <- recipe(Species ~ ., data = iris) %>% step_nnmf_sparse(all_predictors(), seed = 2432, keep_original_cols = TRUE) @@ -85,7 +85,7 @@ test_that('keep_original_cols works', { }) test_that('can prep recipes with no keep_original_cols', { - skip_if(utils::packageVersion("recipes") < "0.1.17.9001") + skip_if_not_installed("recipes", "0.1.17.9001") rec <- recipe(Species ~ ., data = iris) %>% step_nnmf_sparse(all_predictors(), seed = 2432) @@ -105,7 +105,7 @@ test_that('can prep recipes with no keep_original_cols', { }) test_that('tidy method', { - skip_if(utils::packageVersion("recipes") < "1.0.6.9000") + skip_if_not_installed("recipes", "1.0.6.9000") set.seed(1) rec <- recipe(~., data = mtcars) %>% diff --git a/tests/testthat/test-stacks-columns.R b/tests/testthat/test-stacks-columns.R index 2a091f5..a951029 100644 --- a/tests/testthat/test-stacks-columns.R +++ b/tests/testthat/test-stacks-columns.R @@ -15,7 +15,7 @@ library(dplyr) test_that("stacks can accommodate outcome levels that are not valid colnames", { # skip on pre-0.2.4 - skip_if(utils::packageVersion("stacks") < "0.2.3.9001") + skip_if_not_installed("stacks", "0.2.3.9001") skip_if_not_installed("tune", "1.3.0.9006") data("penguins") diff --git a/tests/testthat/test-stacks-tuning.R b/tests/testthat/test-stacks-tuning.R index 3abc631..def97a2 100644 --- a/tests/testthat/test-stacks-tuning.R +++ b/tests/testthat/test-stacks-tuning.R @@ -67,7 +67,7 @@ wf_set <- # tests ------------------------------------------------------------------ test_that("stacking with grid search works", { - skip_if(utils::packageVersion("stacks") < "1.0.0.9000") + skip_if_not_installed("stacks", "1.0.0.9000") wf_set_grid <- workflow_map( @@ -112,7 +112,7 @@ test_that("stacking with grid search works", { }) test_that("stacking with Bayesian tuning works", { - skip_if(utils::packageVersion("stacks") < "1.0.0.9000") + skip_if_not_installed("stacks", "1.0.0.9000") wf_set_bayes <- workflow_map( @@ -158,7 +158,7 @@ test_that("stacking with Bayesian tuning works", { }) test_that("stacking with finetune works (anova)", { - skip_if(utils::packageVersion("stacks") < "1.0.0.9000") + skip_if_not_installed("stacks", "1.0.0.9000") wf_set_anova <- workflow_map( @@ -229,8 +229,8 @@ test_that("stacking with finetune works (anova)", { }) test_that("stacking with finetune works (sim_anneal)", { - skip_if(utils::packageVersion("stacks") < "1.0.0.9000") - skip_if(utils::packageVersion("finetune") < "1.1.0.9001") + skip_if_not_installed("stacks", "1.0.0.9000") + skip_if_not_installed("finetune", "1.1.0.9001") wf_set_sim_anneal <- workflow_map( @@ -293,7 +293,7 @@ test_that("stacking with finetune works (sim_anneal)", { }) test_that("stacking with finetune works (win_loss)", { - skip_if(utils::packageVersion("stacks") < "1.0.0.9000") + skip_if_not_installed("stacks", "1.0.0.9000") wf_set_win_loss <- workflow_map(