tests/testthat/helper.R

# This is a VERY trimmed down version of create_local_thing from usethis
local_package_create <- function(envir = parent.frame()) {
  dir <- withr::local_tempdir(.local_envir = envir)

  usethis::ui_silence({
    create_package(dir, rstudio = FALSE, open = FALSE, check_name = FALSE)
  })

  dir
}

local_package_copy <- function(path, env = parent.frame()) {
  temp_path <- withr::local_tempdir(.local_envir = env)

  dir_copy(path, temp_path, overwrite = TRUE)
  temp_path
}
hadley/devtools documentation built on Feb. 22, 2024, 4:44 a.m.