tests/testthat/test-packrat-mode.R

test_that("packrat_mode successfully sets the library paths when turned on and off", {

  with_dir(tempdir(), {

    ## Make sure packrat mode is off
    if (packrat:::isPackratModeOn())
      packrat::off()

    orig_libs <- getLibPaths()

    # don't use packrat::on so we can avoid the initialization step
    packrat:::setPackratModeOn(auto.snapshot = FALSE, clean.search.path = FALSE)

    packrat::off()

    expect_identical(orig_libs, getLibPaths())

  })

})
rstudio/packrat documentation built on Feb. 5, 2024, 9:17 p.m.