Skip to content

Commit a4a2302

Browse files
committed
fix tests
1 parent e49688a commit a4a2302

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

tests/testthat/test-utils.R

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,14 +327,20 @@ test_that("require_suggested_package() works", {
327327
})
328328

329329
test_that("use_spinner() respects the cmdstanr_spinner option", {
330-
# rlang::is_interactive() is FALSE while testing, so simulate both cases
331-
withr::local_options(rlang_interactive = TRUE)
330+
# rlang::is_interactive() is FALSE while testing, so simulate an interactive
331+
# session. The option and env var are cleared so that the tests don't inherit
332+
# them from the session running the tests.
333+
withr::local_options(list(rlang_interactive = TRUE, cmdstanr_spinner = NULL))
334+
withr::local_envvar(IN_PKGDOWN = NA)
332335
expect_true(use_spinner())
333336
withr::with_options(list(cmdstanr_spinner = FALSE), expect_false(use_spinner()))
334337
withr::with_options(list(cmdstanr_spinner = TRUE), expect_true(use_spinner()))
335338
})
336339

337340
test_that("use_spinner() is FALSE unless interactive", {
341+
withr::local_options(list(cmdstanr_spinner = NULL))
342+
withr::local_envvar(IN_PKGDOWN = NA)
343+
338344
withr::local_options(rlang_interactive = FALSE)
339345
expect_false(use_spinner())
340346
withr::with_options(list(cmdstanr_spinner = TRUE), expect_false(use_spinner()))

0 commit comments

Comments
 (0)