tests/testthat/helper-native-api.R

local_native_api <- local({
  lib <- NULL
  function(frame = parent.frame()) {
    skip_on_cran()
    local_dev_S7_lib(frame = frame)
    if (is.null(lib)) {
      dir.create(lib <<- tempfile("S7-native-api-"))
      install.packages(
        test_path("nativeapi"),
        lib = lib,
        repos = NULL,
        type = "source",
        quiet = TRUE,
        INSTALL_opts = c("--preclean", "--clean", "--no-multiarch")
      )
    }
    ns <- loadNamespace("nativeapi", lib.loc = lib)
    defer(unloadNamespace("nativeapi"), frame = frame)
    ns
  }
})

Try the S7 package in your browser

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

S7 documentation built on Nov. 19, 2026, 9:06 a.m.