tests/testthat/helper-utils.R

## For sparklyr testing

testthat_tbl <- function(name, data = NULL, repartition = 0L) {
	sc <- testthat_spark_connection()

	tbl <- tryCatch(dplyr::tbl(sc, name), error = identity)
	if (inherits(tbl, "error")) {
		if (is.null(data)) data <- eval(as.name(name), envir = parent.frame())
		tbl <- dplyr::copy_to(sc, data, name = name, repartition = repartition)
	}

	tbl
}

Try the orbital package in your browser

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

orbital documentation built on April 3, 2025, 8:47 p.m.