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
}

Try the devtools package in your browser

Any scripts or data that you put into this service are public.

devtools documentation built on Oct. 12, 2022, 1:06 a.m.