tests/testthat/setup.R

#' Setup Tests Infrastructure
#' 

## Temporary Directory ----

create_tempdir <- function(path = file.path(tempdir(), "sandbox")) {
  
  old_wd <- getwd()
  
  withr::defer(fs::dir_delete(path), envir = parent.frame())
  
  dir.create(path)
  
  setwd(path)
  
  withr::defer(setwd(old_wd), envir = parent.frame())
  
  invisible(path)
}
FRBCesab/forcis documentation built on Oct. 25, 2024, 9:26 a.m.