Skip to content

Commit

Permalink
Merge pull request #413 from MichaelChirico/skip-forecast
Browse files Browse the repository at this point in the history
Skip tests requiring Suggests packages
  • Loading branch information
mitchelloharawild authored Sep 24, 2024
2 parents f51d5db + a4dcb89 commit 50b3376
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/testthat/test-ets.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
context("test-ets.R")
skip_if_not_installed("forecast")

forecast_fit <- USAccDeaths %>% forecast::ets()
test_that("Automatic ETS selection", {
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-lm.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
context("test-lm.R")

test_that("LM", {
skip_if_not_installed("forecast")

# NULL model selection
fable_fit <- USAccDeaths_tbl %>% model(lm = TSLM(value))
forecast_fit <- lm(USAccDeaths ~ 1)
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-nnetar.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
context("test-nnetar")
skip_if_not_installed("nnet")

airmiles <- as_tsibble(airmiles)
test_that("Automatic NNETAR selection", {
Expand Down
3 changes: 3 additions & 0 deletions tests/testthat/test-rw.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
context("test-rw.R")
test_that("NAIVE", {
skip_if_not_installed("forecast")
fable_fit <- USAccDeaths_tbl %>% model(naive = NAIVE(value))
forecast_fc <- forecast::naive(USAccDeaths, h = 12)

Expand All @@ -21,6 +22,7 @@ test_that("NAIVE", {
})

test_that("RW w/ drift", {
skip_if_not_installed("forecast")
fable_fit <- USAccDeaths_tbl %>% model(rw = RW(value ~ drift()))
forecast_fc <- forecast::rwf(USAccDeaths, drift = TRUE, h = 12)

Expand Down Expand Up @@ -70,6 +72,7 @@ test_that("RW w/ drift", {
})

test_that("SNAIVE", {
skip_if_not_installed("forecast")
fable_fit <- USAccDeaths_tbl %>% model(snaive = SNAIVE(value))
forecast_fc <- forecast::snaive(USAccDeaths, h = 12)

Expand Down

0 comments on commit 50b3376

Please sign in to comment.