From 7fa26488ab522bf577092e99aad1f2003f21b327 Mon Sep 17 00:00:00 2001 From: simonpcouch Date: Fri, 27 Sep 2024 09:51:50 -0500 Subject: [PATCH] reduce elapsed test time --- tests/testthat/test-cluster.R | 2 +- tests/testthat/test-emmeans.R | 2 +- tests/testthat/test-ergm.R | 5 ++++- tests/testthat/test-glmnetUtils.R | 6 ++++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/testthat/test-cluster.R b/tests/testthat/test-cluster.R index 7661fd75e..397526750 100644 --- a/tests/testthat/test-cluster.R +++ b/tests/testthat/test-cluster.R @@ -12,7 +12,7 @@ skip_if_not_installed("modeldata") library(modeldata) data(hpc_data) -x <- hpc_data[, 2:5] +x <- hpc_data[1:300, 2:5] fit <- pam(x, k = 3) test_that("pam tidier arguments", { diff --git a/tests/testthat/test-emmeans.R b/tests/testthat/test-emmeans.R index 4aac06835..8108790fd 100644 --- a/tests/testthat/test-emmeans.R +++ b/tests/testthat/test-emmeans.R @@ -148,7 +148,7 @@ test_that("tidy.emmGrid for combined contrasts", { method = "consec", simple = "each", combine = TRUE, - adjust = "mvt" + adjust = "dunnettx" ) td_noise <- tidy(noise_c.s) diff --git a/tests/testthat/test-ergm.R b/tests/testthat/test-ergm.R index 8ea6eb9df..3b9c891af 100644 --- a/tests/testthat/test-ergm.R +++ b/tests/testthat/test-ergm.R @@ -11,10 +11,13 @@ library(ergm) data(florentine) data(faux.mesa.high) +# cut down on elapsed time at the expense of model performance +ctrl <- control.ergm(MCMLE.maxit = 2) + gest <- ergm(flomarriage ~ edges + absdiff("wealth")) gest2 <- ergm(flomarriage ~ edges + absdiff("wealth"), family = "gaussian") suppressWarnings({ - gest3 <- ergm(faux.mesa.high ~ edges + degree(1:3)) + gest3 <- ergm(faux.mesa.high ~ edges + degree(1:3), control = ctrl) }) test_that("ergm tidier arguments", { diff --git a/tests/testthat/test-glmnetUtils.R b/tests/testthat/test-glmnetUtils.R index 089910c9b..bab2f9086 100644 --- a/tests/testthat/test-glmnetUtils.R +++ b/tests/testthat/test-glmnetUtils.R @@ -14,6 +14,8 @@ skip_if_not_installed("modeldata") library(modeldata) data(hpc_data) +hpc_data <- hpc_data[1:300, ] + fit <- glmnet(formula = mpg ~ ., data = mtcars) fit2 <- glmnet( formula = class ~ compounds + input_fields + iterations + num_pending, @@ -58,8 +60,8 @@ test_that("tidy.glmnet.formula", { expect_is(td2, "tbl_df") - expect_equal(dim(td2), c(983L, 6L)) - expect_equal(dim(td2z), c(1240L, 6L)) + expect_equal(dim(td2), c(1511L, 6L)) + expect_equal(dim(td2z), c(2000L, 6L)) expect_true(all(td2$estimate != 0)) expect_true(any(td2z$estimate == 0))