Skip to content

Commit

Permalink
Fix accidental override in skip_on_cran() (#1869)
Browse files Browse the repository at this point in the history
Fixes #1868
  • Loading branch information
hadley authored Sep 26, 2023
1 parent b138bf7 commit 97887bc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# testthat (development version)

* `options(rlang_interactive = TRUE)` no longer causes `skip_on_cran()` to
not run on CRAN (#1868).

* The skip column is now two characters wide to have a consistent width in case
10 or more tests are skipped in a single file (@mgirlich, #1844).

Expand Down
2 changes: 1 addition & 1 deletion R/skip.R
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ on_bioc <- function() {
env_var_is_true("IS_BIOC_BUILD_MACHINE")
}
on_cran <- function() {
!is_interactive() && !env_var_is_true("NOT_CRAN")
!interactive() && !env_var_is_true("NOT_CRAN")
}

env_var_is_true <- function(x) {
Expand Down
5 changes: 2 additions & 3 deletions tests/testthat/test-skip.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,11 @@ test_that("skip_on_cran() works as expected", {
expect_no_skip(skip_on_cran())

withr::local_envvar(NOT_CRAN = "false")
withr::local_options(rlang_interactive = FALSE)
local_mocked_bindings(interactive = function() FALSE)
expect_snapshot_skip(skip_on_cran(), cran = TRUE)

withr::local_options(rlang_interactive = TRUE)
local_mocked_bindings(interactive = function() TRUE)
expect_no_skip(skip_on_cran())

})

test_that("skip_on_ci() works as expected", {
Expand Down

0 comments on commit 97887bc

Please sign in to comment.