tests/testthat.R

# determine if tests should be skipped
is_skip <- !identical(Sys.getenv("NOT_CRAN"), "true")

# run tests if needed
if (!is_skip) {
  ## load packages
  library(testthat)
  library(prioritizr)

  ## try to load solver packages
  suppressWarnings(require(gurobi))
  suppressWarnings(require(lpsymphony))
  suppressWarnings(require(Rsymphony))

  ## disable parallel testing
  Sys.unsetenv("R_TESTS")

  ## determine reporter
  if (identical(Sys.getenv("CI"), "true")) {
    reporter <- "progress"
  } else {
    reporter <- testthat::check_reporter()
  }

  ## check tests
  test_check("prioritizr", reporter = reporter)
}

Try the prioritizr package in your browser

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

prioritizr documentation built on Aug. 9, 2023, 1:06 a.m.