local_temppkg: Temporary package

View source: R/helpers.R

local_temppkgR Documentation

Temporary package

Description

Temporarily create a rdev or R analysis package, which is automatically removed afterwards.

Usage

local_temppkg(dir = fs::file_temp(), type = "usethis", env = parent.frame())

Arguments

dir

Path to package directory, created if necessary, defaults to fs::file_temp().

type

type of package to create, one of "usethis" - usethis::create_package(), "rdev" - use_rdev_package(), "analysis" - use_analysis_package(use_quarto = FALSE), or "quarto" - use_analysis_package(use_quarto = TRUE).

env

Environment passed to withr::defer(), defaults to parent.frame().

Details

Used internally for testing rdev automation. Based on the usethis case study from testthat.

Value

Path to temporary package directory.

See Also

withr::withr-package

Examples

## Not run: 
test_that("local_temppkg creates a directory", {
  dir <- usethis::ui_silence(local_temppkg())
  expect_true(fs::dir_exists(dir))
})

## End(Not run)

jabenninghoff/rdev documentation built on Sept. 26, 2024, 10:37 p.m.