R/test-helpers.R

Defines functions local_create_package

local_create_package <- function(dir = fs::file_temp(), env = parent.frame()) {
  old_wd <- getwd()

  usethis::create_package(dir, open = FALSE)
  withr::defer(fs::dir_delete(dir), envir = env)

  setwd(dir)
  withr::defer(setwd(old_wd), envir = env)

  dir
}
subugoe/muggle documentation built on Nov. 26, 2021, 11:42 p.m.