Skip to content

Commit

Permalink
Remove some skips in tests (#935)
Browse files Browse the repository at this point in the history
* Remove some skips in tests

* reverse

* fix

* test

* remove skips

* fix
  • Loading branch information
strengejacke authored Sep 27, 2024
1 parent 27dc704 commit 6173154
Show file tree
Hide file tree
Showing 17 changed files with 7 additions and 61 deletions.
1 change: 0 additions & 1 deletion tests/testthat/test-cgam.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
skip_if_not_installed("cgam")
skip_if_not(getRversion() >= "4.0.0")

data(cubic, package = "cgam")
incr.conv <- cgam::incr.conv
Expand Down
10 changes: 3 additions & 7 deletions tests/testthat/test-cpglmm.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
## FIXME: suddenly fails on CRAN for win-devel?
skip_if(getRversion() > "4.3.3")

skip_if_not(getRversion() >= "4.4.0")
skip_if_not_installed("cplm")

# cplm::cpglmm doesn't work
Expand Down Expand Up @@ -144,16 +142,14 @@ test_that("is_multivariate", {
})

test_that("get_variance", {
skip_if_not(getRversion() > "3.6.3")
skip_on_os("windows", arch = "i386")
skip_on_cran()
expect_equal(
suppressWarnings(get_variance(m1)),
list(
var.fixed = 0.1687617,
var.random = 0.0002706301,
var.residual = 2.763129,
var.distribution = 2.763129,
var.residual = 2.682131,
var.distribution = 2.682131,
var.dispersion = 0,
var.intercept = c(Plant = 0.0002706301)
),
Expand Down
25 changes: 0 additions & 25 deletions tests/testthat/test-emmeans.R
Original file line number Diff line number Diff line change
@@ -1,26 +1,3 @@
## These tests fail on current R-devel (win-builder), not sure why

# * using R Under development (unstable) (2023-03-14 r83979 ucrt)
# * using platform: x86_64-w64-mingw32 (64-bit)
# * R was compiled by
# gcc.exe (GCC) 12.2.0
# GNU Fortran (GCC) 12.2.0
# * running under: Windows Server 2022 x64 (build 20348)

# ── Failure ('test-emmeans.R:14:5'): emmeans ────────────────────────────────────
# get_statistic(EList)$Statistic (`actual`) not equal to c(1.449, -0.377, -2.346, 1.243, 2.717, 1.393) (`expected`).

# `actual`: 1.2429 2.7166 1.3925 1.2429 2.7166 1.3925
# `expected`: 1.4490 -0.3770 -2.3460 1.2430 2.7170 1.3930
# ── Failure ('test-emmeans.R:15:5'): emmeans ────────────────────────────────────
# get_statistic(EList)$Statistic[1:3] (`actual`) not equal to get_statistic(E)$Statistic (`expected`).

# `actual`: 1.2 2.7 1.4
# `expected`: 1.4 -0.4 -2.3

# [ FAIL 2 | WARN 0 | SKIP 25 | PASS 3366 ]

skip_if(getRversion() > "4.2.2")
skip_if_not_installed("emmeans")

test_that("emmeans", {
Expand All @@ -29,9 +6,7 @@ test_that("emmeans", {
)

EList <- emmeans::emmeans(m, pairwise ~ cyl, type = "resp")

E <- emmeans::emmeans(m, ~cyl, type = "resp")

C <- emmeans::contrast(E, method = "pairwise")

expect_identical(find_statistic(EList), "z-statistic")
Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test-fixest.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
skip_if(TRUE)

skip_on_os("mac")
skip_if(getRversion() < "3.6.0")
skip_if_not_installed("fixest", minimum_version = "0.11.2")
skip_if_not_installed("carData")
skip_if_not_installed("withr")
Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test-get_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,6 @@ test_that("workaround bug in estimatr", {

test_that("get_data colnames", {
skip_on_os("windows")
skip_if_not(getRversion() >= "4.0.0")
skip_if_not_installed("brms")
m <- suppressMessages(suppressWarnings(brms::brm(mpg ~ hp + mo(cyl), data = mtcars, refresh = 0, iter = 200, chains = 1)))
out <- get_data(m)
Expand Down
3 changes: 0 additions & 3 deletions tests/testthat/test-get_datagrid.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
skip_if_not(getRversion() >= "4.0.0")

m1 <- lm(hp ~ ordered(cyl), data = mtcars)
m2 <- lm(hp ~ as.ordered(cyl), data = mtcars)
m3 <- lm(hp ~ as.factor(cyl), data = mtcars)
Expand Down Expand Up @@ -155,7 +153,6 @@ test_that("get_datagrid - models", {
"Some package uses `formula.tools::as.character.formula()` which breaks `find_formula()`."
)

skip_if(getRversion() > "4.3.3")
skip_if_not_installed("gamm4")
skip_if_not_installed("glmmTMB")
skip_if_not_installed("mgcv")
Expand Down
4 changes: 0 additions & 4 deletions tests/testthat/test-get_predicted.R
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ test_that("MASS::rlm", {
# =========================================================================

test_that("get_predicted - lmerMod", {
skip_if(getRversion() > "4.3.3")
suppressWarnings(skip_if_not_installed("glmmTMB"))
skip_if_not_installed("lme4")
skip_if_not_installed("merTools")
Expand Down Expand Up @@ -289,7 +288,6 @@ test_that("get_predicted - lmerMod (log)", {


test_that("get_predicted - merMod", {
skip_if(getRversion() > "4.3.3")
skip_if_not_installed("lme4")
skip_if_not_installed("glmmTMB")
x <- lme4::glmer(vs ~ am + (1 | cyl), data = mtcars, family = "binomial")
Expand All @@ -312,7 +310,6 @@ test_that("get_predicted - merMod", {


test_that("get_predicted - glmmTMB", {
skip_if(getRversion() > "4.3.3")
skip_if_not_installed("glmmTMB")
x <- glmmTMB::glmmTMB(mpg ~ am + (1 | cyl), data = mtcars)

Expand Down Expand Up @@ -630,7 +627,6 @@ test_that("brms: `type` in ellipsis used to produce the wrong intervals", {


test_that("zero-inflation stuff works", {
skip_if(getRversion() > "4.3.3")
skip_if_not_installed("glmmTMB")
skip_if_not_installed("pscl")

Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test-get_variance.R
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,6 @@ test_that("random effects CIs, poly slope", {
})

test_that("fixed effects variance for rank-deficient models, #765", {
skip_if(getRversion() > "4.3.3")
skip_if_not_installed("glmmTMB", minimum_version = "1.1.8")
set.seed(101)
dd <- data.frame(
Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test-glmmTMB.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
skip_on_os("mac") # error: FreeADFunObject
skip_if_not(getRversion() >= "4.0.0")
skip_if_not_installed("TMB")
skip_if_not_installed("glmmTMB")

Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test-htest.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ test_that("model_info.t-test", {

# One sample
test_that("get_data.t-test, one-sample", {
skip_if(getRversion() < "4.0.0")
tt1 <- t.test(mtcars$mpg)
tt2 <- t.test(mtcars$mpg ~ 1)
expect_equal(
Expand Down
2 changes: 0 additions & 2 deletions tests/testthat/test-is_converged.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
skip_if_not_installed("lme4")
skip_if_not(getRversion() >= "4.0.0")

data(cbpp, package = "lme4")
data(sleepstudy, package = "lme4")
Expand Down Expand Up @@ -27,7 +26,6 @@ test_that("is_converged", {

skip_on_os("mac") # error: FreeADFunObject
skip_on_cran() ## FIXME: check with win-devel
skip_if(getRversion() > "4.3.3")
skip_if_not_installed("glmmTMB")
skip_if_not_installed("TMB")

Expand Down
2 changes: 0 additions & 2 deletions tests/testthat/test-mlogit.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,10 @@ test_that("find_response", {
})

test_that("get_response", {
skip_if_not(getRversion() >= "3.6.0")
expect_identical(get_response(m1), as.vector(Fish$mode))
})

test_that("get_data", {
skip_if_not(getRversion() >= "3.6.0")
expect_identical(nrow(get_data(m1, verbose = FALSE)), 4728L)
expect_identical(nrow(get_data(m2, verbose = FALSE)), 4728L)

Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test-mmrm.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
skip_if_not_installed("mmrm")
skip_if(getRversion() < "4.0.0")

# see https://github.com/georgheinze/logistf/pull/54
skip_if(
Expand Down
2 changes: 0 additions & 2 deletions tests/testthat/test-model_data.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
skip_if_not_installed("splines")
skip_if_not_installed("TMB")
skip_if_not_installed("glmmTMB")
skip_if_not(getRversion() >= "4.0.0")

m1 <- lm(Sepal.Length ~ Species + splines::ns(Petal.Width), data = iris)
m2 <- lm(Sepal.Length ~ Species + splines::ns(Petal.Width, knots = 2), data = iris)
Expand All @@ -23,7 +22,6 @@ test_that("get_data", {
expect_identical(as.vector(mf4$Petal.Width), as.vector(mf5$Petal.Width))
})

skip_if(getRversion() > "4.3.3")
data(Salamanders, package = "glmmTMB")
skip_on_os("mac") # error: FreeADFunObject
m <- glmmTMB::glmmTMB(
Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test-model_info.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ test_that("bigglm bernoulli", {
})

test_that("glmmTMB bernoulli", {
skip_if(getRversion() > "4.3.3")
skip_if_not_installed("glmmTMB")
data(mtcars)
model <- glmmTMB::glmmTMB(vs ~ disp, data = mtcars, family = binomial())
Expand Down
2 changes: 0 additions & 2 deletions tests/testthat/test-null_model.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
skip_if_not_installed("glmmTMB")
skip_if_not_installed("lme4")
skip_if_not_installed("TMB")
skip_if_not(getRversion() >= "4.0.0")


test_that("null_model with offset", {
m1 <- suppressWarnings(lme4::glmer.nb(mpg ~ disp + (1 | cyl) + offset(log(wt)), data = mtcars))
Expand Down
10 changes: 4 additions & 6 deletions tests/testthat/test-spatial.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
skip_if_offline()
skip_if(getRversion() > "4.3.3")
skip_if_not(getRversion() >= "4.4.0")
suppressWarnings(skip_if_not_installed("glmmTMB"))
suppressWarnings(skip_if_not_installed("geoR"))
skip_if_not_installed("TMB")
Expand Down Expand Up @@ -146,18 +146,16 @@ test_that("get_data", {
})


test_that("get_paramaters", {
expect_identical(nrow(get_parameters(m1)), 5L)
test_that("get_parameters", {
expect_identical(nrow(get_parameters(m1)), 4L)
expect_identical(
get_parameters(m1)$Parameter,
c("(Intercept)", "elevation", "region2", "region3", "(Intercept)")
c("(Intercept)", "elevation", "region2", "region3")
)
})

test_that("find_random_slopes", {
skip_on_cran()


expect_identical(
find_random_slopes(m1),
list(random = "pos")
Expand Down

0 comments on commit 6173154

Please sign in to comment.