tests/testthat/helper-setup_temporary_package.R

# This code runs before the tests. It creates a testpackage in
# the temporary directory where all the functions of rrtools
# can be applied safely and subsequently tested.

# create temporary directory in file system
tempdirstr <- tempdir()
unlink(tempdirstr)
playground_path <- paste0(tempdirstr, "/testpackages")
dir.create(playground_path, showWarnings = FALSE)

# create test package
package_path <- paste0(
  playground_path,
  tempfile(pattern = "testpackage.", tmpdir = "", fileext = "")
)
# dir.create(package_path)

library(rrtools)
rrtools:::quietly(
use_compendium(
  path = package_path,
  fields = getOption("devtools.desc"),
  rstudio = FALSE,
  open = FALSE,
  simple = FALSE,
  quiet = TRUE
))
benmarwick/rrtools documentation built on March 18, 2024, 2:22 a.m.