tests/testthat/helper-runtime.R

rbiogeme_test_configure_python <- function() {
  python <- Sys.getenv("RBIOGEME_PYTHON", unset = "")
  if (!nzchar(python) || !file.exists(python)) {
    return(FALSE)
  }

  if (!reticulate::py_available(initialize = FALSE)) {
    tryCatch(
      rbiogeme::biogeme_config(python = python),
      error = function(...) NULL
    )
  }

  configured <- isTRUE(tryCatch(
    {
      configuration <- rbiogeme::biogeme_python()
      identical(normalizePath(configuration$python), normalizePath(python))
    },
    error = function(...) FALSE
  ))

  configured && isTRUE(tryCatch(
    reticulate::py_module_available("biogeme"),
    error = function(...) FALSE
  ))
}

rbiogeme_test_swissmetro_path <- function() {
  path <- Sys.getenv("RBIOGEME_SWISSMETRO_DATA", unset = "")
  if (!nzchar(path) || !file.exists(path)) {
    return("")
  }
  normalizePath(path)
}

Try the rbiogeme package in your browser

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

rbiogeme documentation built on Sept. 29, 2026, 5:09 p.m.