tests/testthat.R

do <- function() {
  old <- Sys.getenv("R_PKG_CACHE_DIR", NA_character_)
  if (is.na(old)) {
    on.exit(Sys.unsetenv("R_PKG_CACHE_DIR"), add = TRUE)
  } else {
    on.exit(Sys.setenv("R_PKG_CACHE_DIR" = old), add = TRUE)
  }
  Sys.setenv("R_PKG_CACHE_DIR" = tempfile())

  library(pak)
  library(testthat)
  test_check("pak", reporter = "summary")
}

if (Sys.getenv("NOT_CRAN") == "true") {
  do()
}
r-lib/pkgman documentation built on Nov. 18, 2024, 2:23 p.m.