diff --git a/tests/testthat/test-add_header_rows.R b/tests/testthat/test-add_header_rows.R index c0b41974..fd38de1b 100644 --- a/tests/testthat/test-add_header_rows.R +++ b/tests/testthat/test-add_header_rows.R @@ -140,6 +140,7 @@ test_that("test tidy_add_header_rows() checks", { }) test_that("tidy_add_header_rows() works with nnet::multinom", { + skip_on_cran() mod <- nnet::multinom(grade ~ stage + marker + age + trt, data = gtsummary::trial, trace = FALSE) res <- mod %>% tidy_and_attach() %>% @@ -201,6 +202,7 @@ test_that("test tidy_add_header_rows() bad single row request", { test_that("tidy_add_header_rows() and mixed model", { + skip_on_cran() skip_if_not_installed("lme4") mod <- lme4::lmer( age ~ stage + (stage | grade) + (1 | grade), diff --git a/tests/testthat/test-add_n.R b/tests/testthat/test-add_n.R index 90fe48e0..944c22fd 100644 --- a/tests/testthat/test-add_n.R +++ b/tests/testthat/test-add_n.R @@ -171,12 +171,14 @@ test_that("tidy_add_n() works with lme4::glmer", { test_that("tidy_add_n() works with survival::coxph", { + skip_on_cran() df <- survival::lung %>% dplyr::mutate(sex = factor(sex)) mod <- survival::coxph(survival::Surv(time, status) ~ ph.ecog + age + sex, data = df) expect_error(mod %>% tidy_and_attach() %>% tidy_add_n(), NA) }) test_that("tidy_add_n() works with survival::survreg", { + skip_on_cran() mod <- survival::survreg( survival::Surv(futime, fustat) ~ factor(ecog.ps) + rx, survival::ovarian, @@ -186,6 +188,7 @@ test_that("tidy_add_n() works with survival::survreg", { }) test_that("tidy_add_n() works with nnet::multinom", { + skip_on_cran() mod <- nnet::multinom(grade ~ stage + marker + age, data = gtsummary::trial, trace = FALSE) expect_error(mod %>% tidy_and_attach() %>% tidy_add_n(), NA) diff --git a/tests/testthat/test-add_reference_rows.R b/tests/testthat/test-add_reference_rows.R index 8ad3e4a4..db9194ae 100644 --- a/tests/testthat/test-add_reference_rows.R +++ b/tests/testthat/test-add_reference_rows.R @@ -215,6 +215,7 @@ test_that("tidy_add_reference_rows() use var_label if available", { }) test_that("tidy_add_reference_rows() works with nnet::multinom", { + skip_on_cran() mod <- nnet::multinom(grade ~ stage + marker + age, data = gtsummary::trial, trace = FALSE) res <- mod %>% tidy_and_attach() %>% @@ -247,9 +248,9 @@ test_that("tidy_add_reference_rows() works with lme4::glmer", { test_that("tidy_add_reference_rows() works with glmmTMB::glmmTMB", { + skip_on_cran() skip_if_not_installed("glmmTMB") skip_if_not_installed("broom.mixed") - skip_on_cran() mod <- glmmTMB::glmmTMB(count ~ mined + spp, ziformula = ~ mined, diff --git a/tests/testthat/test-add_term_labels.R b/tests/testthat/test-add_term_labels.R index 3f068208..50db21b9 100644 --- a/tests/testthat/test-add_term_labels.R +++ b/tests/testthat/test-add_term_labels.R @@ -184,6 +184,7 @@ test_that("tidy_add_term_labels() works with poly or helmert contrasts", { test_that("tidy_add_term_labels() works with variables having non standard name", { + skip_on_cran() df <- gtsummary::trial %>% dplyr::rename( `grade of kids...` = grade, `?? treatment ++ response ...` = response @@ -222,6 +223,7 @@ test_that("tidy_add_term_labels() works with variables having non standard name" test_that("tidy_add_term_labels() works with stats::poly()", { + skip_on_cran() df <- iris %>% labelled::set_variable_labels(Petal.Length = "Length of petal") mod <- lm(Sepal.Length ~ poly(Sepal.Width, 3) + poly(Petal.Length, 2), df) res <- mod %>% @@ -257,12 +259,14 @@ test_that("tidy_add_term_labels() works with lme4::glmer", { test_that("tidy_add_term_labels() works with survival::coxph", { + skip_on_cran() df <- survival::lung %>% dplyr::mutate(sex = factor(sex)) mod <- survival::coxph(survival::Surv(time, status) ~ ph.ecog + age + sex, data = df) expect_error(mod %>% tidy_and_attach() %>% tidy_add_term_labels(), NA) }) test_that("tidy_add_term_labels() works with survival::survreg", { + skip_on_cran() mod <- survival::survreg( survival::Surv(futime, fustat) ~ ecog.ps + rx, survival::ovarian, @@ -272,11 +276,13 @@ test_that("tidy_add_term_labels() works with survival::survreg", { }) test_that("tidy_add_term_labels() works with nnet::multinom", { + skip_on_cran() mod <- nnet::multinom(grade ~ stage + marker + age, data = gtsummary::trial, trace = FALSE) expect_error(mod %>% tidy_and_attach() %>% tidy_add_term_labels(), NA) }) test_that("tidy_add_term_labels() works with survey::svyglm", { + skip_on_cran() skip_if_not_installed("survey") df <- survey::svydesign(~1, weights = ~1, data = gtsummary::trial) mod <- survey::svyglm(response ~ age + grade * trt, df, family = quasibinomial) @@ -284,24 +290,28 @@ test_that("tidy_add_term_labels() works with survey::svyglm", { }) test_that("tidy_add_term_labels() works with ordinal::clm", { + skip_on_cran() mod <- ordinal::clm(rating ~ temp * contact, data = ordinal::wine) expect_error(mod %>% tidy_and_attach() %>% tidy_add_term_labels(), NA) }) test_that("tidy_add_term_labels() works with ordinal::clmm", { + skip_on_cran() mod <- ordinal::clmm(rating ~ temp * contact + (1 | judge), data = ordinal::wine) expect_error(mod %>% tidy_and_attach() %>% tidy_add_term_labels(), NA) }) test_that("tidy_add_term_labels() works with MASS::polr", { + skip_on_cran() mod <- MASS::polr(Sat ~ Infl + Type + Cont, weights = Freq, data = MASS::housing) expect_error(mod %>% tidy_and_attach() %>% tidy_add_term_labels(), NA) }) test_that("tidy_add_term_labels() works with geepack::geeglm", { + skip_on_cran() skip_if(packageVersion("geepack") < 1.3) df <- geepack::dietox @@ -315,6 +325,7 @@ test_that("tidy_add_term_labels() works with geepack::geeglm", { test_that("tidy_add_term_labels() works with gam::gam", { + skip_on_cran() skip_if_not_installed("gam") data(kyphosis, package = "gam") mod <- gam::gam(Kyphosis ~ gam::s(Age, 4) + Number, family = binomial, data = kyphosis) @@ -329,6 +340,7 @@ test_that("tidy_add_term_labels() works with gam::gam", { test_that("tidy_add_term_labels() works with lavaan::lavaan", { + skip_on_cran() skip_if_not_installed("lavaan") df <- lavaan::HolzingerSwineford1939 df$grade <- factor(df$grade, ordered = TRUE) diff --git a/tests/testthat/test-model_get_n.R b/tests/testthat/test-model_get_n.R index 7348efdc..fe0957a1 100644 --- a/tests/testthat/test-model_get_n.R +++ b/tests/testthat/test-model_get_n.R @@ -180,6 +180,7 @@ test_that("model_get_n() works with different contrasts", { test_that("model_get_n() works with stats::poly()", { + skip_on_cran() mod <- lm(Sepal.Length ~ poly(Sepal.Width, 3) + poly(Petal.Length, 2), iris) expect_error(res <- mod %>% model_get_n(), NA) expect_equivalent(names(res), c("term", "n_obs")) @@ -224,6 +225,7 @@ test_that("model_get_n() works with lme4::glmer", { test_that("model_get_n() works with survival::coxph", { + skip_on_cran() df <- survival::lung %>% dplyr::mutate(sex = factor(sex)) mod <- survival::coxph(survival::Surv(time, status) ~ ph.ecog + age + sex, data = df) expect_error(res <- mod %>% model_get_n(), NA) @@ -244,6 +246,7 @@ test_that("model_get_n() works with survival::coxph", { }) test_that("model_get_n() works with survival::survreg", { + skip_on_cran() mod <- survival::survreg( survival::Surv(futime, fustat) ~ factor(ecog.ps) + rx, survival::ovarian, @@ -254,6 +257,7 @@ test_that("model_get_n() works with survival::survreg", { }) test_that("model_get_n() works with nnet::multinom", { + skip_on_cran() mod <- nnet::multinom(grade ~ stage + marker + age, data = gtsummary::trial, trace = FALSE) expect_error(res <- mod %>% model_get_n(), NA) expect_equivalent(names(res), c("y.level", "term", "n_obs", "n_event")) @@ -277,6 +281,7 @@ test_that("model_get_n() works with nnet::multinom", { }) test_that("model_get_n() works with survey::svyglm", { + skip_on_cran() skip_if_not_installed("survey") df <- survey::svydesign(~1, weights = ~1, data = gtsummary::trial) mod <- survey::svyglm(response ~ age + grade * trt, df, family = quasibinomial) @@ -301,6 +306,7 @@ test_that("model_get_n() works with survey::svyglm", { }) test_that("model_get_n() works with ordinal::clm", { + skip_on_cran() mod <- ordinal::clm(rating ~ temp * contact, data = ordinal::wine) expect_error(res <- mod %>% model_get_n(), NA) expect_equivalent(names(res), c("term", "n_obs")) @@ -309,6 +315,7 @@ test_that("model_get_n() works with ordinal::clm", { test_that("model_get_n() works with ordinal::clmm", { + skip_on_cran() mod <- ordinal::clmm(rating ~ temp * contact + (1 | judge), data = ordinal::wine) expect_error(res <- mod %>% model_get_n(), NA) expect_equivalent(names(res), c("term", "n_obs")) @@ -316,6 +323,7 @@ test_that("model_get_n() works with ordinal::clmm", { test_that("model_get_n() works with MASS::polr", { + skip_on_cran() mod <- MASS::polr(Sat ~ Infl + Type + Cont, weights = Freq, data = MASS::housing) expect_error(res <- mod %>% model_get_n(), NA) expect_equivalent(names(res), c("term", "n_obs")) @@ -323,6 +331,7 @@ test_that("model_get_n() works with MASS::polr", { test_that("model_get_n() works with geepack::geeglm", { + skip_on_cran() skip_if(packageVersion("geepack") < 1.3) df <- geepack::dietox @@ -343,6 +352,7 @@ test_that("model_get_n() works with geepack::geeglm", { test_that("model_get_n() works with gam::gam", { + skip_on_cran() skip_if_not_installed("gam") data(kyphosis, package = "gam") mod <- gam::gam(Kyphosis ~ gam::s(Age, 4) + Number, family = binomial, data = kyphosis) @@ -352,6 +362,7 @@ test_that("model_get_n() works with gam::gam", { test_that("model_get_n() works with lavaan::lavaan", { + skip_on_cran() skip_if_not_installed("lavaan") df <- lavaan::HolzingerSwineford1939 df$grade <- factor(df$grade, ordered = TRUE) diff --git a/tests/testthat/test-tidy_plus_plus.R b/tests/testthat/test-tidy_plus_plus.R index a292a0b4..4746e341 100644 --- a/tests/testthat/test-tidy_plus_plus.R +++ b/tests/testthat/test-tidy_plus_plus.R @@ -52,6 +52,7 @@ test_that("tidy_plus_plus() works with no intercept models", { }) test_that("tidy_plus_plus() and functionnal programming", { + skip_on_cran() # works with glm expect_error( res <- dplyr::tibble(grade = c("I", "II", "III")) %>% @@ -122,6 +123,7 @@ test_that("tidy_plus_plus() with mice objects", { test_that("tidy_plus_plus() with tidyselect", { + skip_on_cran() # build regression model mod <- lm(age ~ trt + marker + grade, gtsummary::trial) @@ -152,6 +154,7 @@ test_that("tidy_plus_plus() with tidyselect", { }) test_that("tidy_plus_plus() works with stats::aov", { + skip_on_cran() mod <- aov(yield ~ block + N * P * K, npk) expect_error( res <- tidy_plus_plus(mod), @@ -212,6 +215,7 @@ test_that("tidy_plus_plus() works with lme4::glmer.nb", { }) test_that("tidy_plus_plus() works with survival::coxph", { + skip_on_cran() df <- survival::lung %>% dplyr::mutate(sex = factor(sex)) mod <- survival::coxph(survival::Surv(time, status) ~ ph.ecog + age + sex, data = df) expect_error( @@ -221,6 +225,7 @@ test_that("tidy_plus_plus() works with survival::coxph", { }) test_that("tidy_plus_plus() works with survival::survreg", { + skip_on_cran() mod <- survival::survreg( survival::Surv(futime, fustat) ~ ecog.ps + rx, survival::ovarian, @@ -289,8 +294,8 @@ test_that("tidy_plus_plus() works with nnet::multinom", { }) test_that("tidy_plus_plus() works with survey::svyglm", { - skip_if_not_installed("survey") skip_on_cran() + skip_if_not_installed("survey") df <- survey::svydesign(~1, weights = ~1, data = gtsummary::trial) mod <- survey::svyglm(response ~ age + grade * trt, df, family = quasibinomial) expect_error( @@ -300,8 +305,8 @@ test_that("tidy_plus_plus() works with survey::svyglm", { }) test_that("tidy_plus_plus() works with survey::svycoxph", { - skip_if_not_installed("survey") skip_on_cran() + skip_if_not_installed("survey") dpbc <- survey::svydesign(id = ~ 1, prob = ~ 1, strata = ~ edema, data = survival::pbc) mod <- survey::svycoxph( Surv(time, status > 0) ~ log(bili) + protime + albumin, @@ -314,8 +319,8 @@ test_that("tidy_plus_plus() works with survey::svycoxph", { }) test_that("tidy_plus_plus() works with survey::svyolr", { - skip_if_not_installed("survey") skip_on_cran() + skip_if_not_installed("survey") data(api, package = "survey") fpc <- survey::svydesign(id = ~ dnum, weights = ~ pw, data = apiclus1, fpc = ~ fpc) fpc <- update(fpc, mealcat = cut(meals, c(0, 25, 50, 75, 100))) @@ -347,6 +352,7 @@ test_that("tidy_plus_plus() works with ordinal::clmm", { test_that("tidy_plus_plus() works with MASS::polr", { + skip_on_cran() mod <- MASS::polr(Sat ~ Infl + Type + Cont, weights = Freq, data = MASS::housing) expect_error( res <- mod %>% tidy_plus_plus(), @@ -454,6 +460,7 @@ test_that("tidy_plus_plus() works with tidycmprsk::crr", { test_that("tidy_plus_plus() works with stats::nls", { + skip_on_cran() mod <- stats::nls( Petal.Width ~ a * Petal.Length - (Sepal.Width + Sepal.Length) / b + a^2, data = iris,