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)
}


## Setup httptest2

library(httptest2)
FRBCesab/forcis documentation built on April 14, 2025, 9:34 a.m.