tests/testthat/helper-interactive.R

if (interactive()) {

  # create a 'done' object that, when printed, will
  # run any pending defer handlers
  envir <- attach(NULL, name = "tools:renv")
  envir$done <- structure(list(), class = "renv_done")
  registerS3method("print", "renv_done", function(x, ...) {
    renv:::renv_defer_execute(teardown_env())
  })

  # detach when we're done
  defer(detach("tools:renv"), scope = teardown_env())

}

Try the renv package in your browser

Any scripts or data that you put into this service are public.

renv documentation built on Sept. 19, 2023, 9:06 a.m.