tests/testthat/test_require.R

test_that("existing package does not throw error", {
  expect_error(uses("tidyr", stop, "test"), NA)
})

test_that("non-existing package throws error", {
  mockery::stub(uses, "requireNamespace", FALSE)
  expect_error(uses("Seurat", stop, "test"), "test")
})
AhmedMehdiLab/E.PAGE documentation built on Aug. 21, 2022, 4:37 p.m.