tests/testthat/test_with_package.R

test_that("with_package", {
  skip_if_not_installed("callr")

  before = .packages()
  expect_number(with_package("callr", {
    r(function() runif(1))
  }), lower = 0, upper = 1)
  expect_equal(before, .packages())
})

Try the mlr3misc package in your browser

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

mlr3misc documentation built on April 4, 2025, 1:51 a.m.