Skip to content

Commit

Permalink
skip temp install during rcmd check
Browse files Browse the repository at this point in the history
closes #355
  • Loading branch information
maxheld83 committed Dec 9, 2021
1 parent 315b2fa commit 805f5da
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
5 changes: 5 additions & 0 deletions R/test-helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ local_mc <- function(env = parent.frame()) {
)
}

#' Test if being run inside of R CMD check
#' Inlined from https://rdrr.io/github/r-lib/cli/src/R/progress-utils.R
#' @noRd
is_rcmd_check <- function() Sys.getenv("_R_CHECK_PACKAGE_NAME_", "") != ""

#' Temporarily set future plan
#' @inheritParams future::strategy
#' @noRd
Expand Down
8 changes: 6 additions & 2 deletions tests/testthat/setup.R
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
# multisession futures need locally installed metacheck
local_mc(env = testthat::teardown_env())
# better/stricter debugging of future, but slower
# see https://future.futureverse.org/articles/future-4-non-exportable-objects.html
withr::local_options(
list(future.globals.onReference = "error"),
.local_envir = testthat::teardown_env()
)
4 changes: 4 additions & 0 deletions tests/testthat/test-communicate.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# shiny app ====

# multisession futures need locally installed metacheck
# but not inside R cmd check where pkg is already installed
if (!is_rcmd_check()) local_mc()

test_that("shiny app works", {
app <- shinytest::ShinyDriver$new(mcControlsApp())
app$click("test-dois-fill_ex")
Expand Down
4 changes: 4 additions & 0 deletions tests/testthat/test-email.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ test_that("email is smaller than 102KB to meet google limit", {
expect_true(lobstr::obj_size(email_source) / 1000 < 102)
})

# multisession futures need locally installed metacheck
# but not inside R cmd check where pkg is already installed
if (!is_rcmd_check()) local_mc()

test_that("email can be send", {
skip_if_not_smtp_auth()
skip_if_offline()
Expand Down

0 comments on commit 805f5da

Please sign in to comment.