test_redis_available <- function() {
available <- redux::redis_available()
if (!available) {
testthat::skip("Skipping test as redis is not available")
}
invisible(available)
}
MockQueue <- R6::R6Class(
"MockQueue",
inherit = hintr:::Queue,
cloneable = FALSE,
public = list(
submit = function(data, options) {
self$queue$enqueue_(quote(stop("test error")))
}
)
)
test_queue <- function(workers = 0) {
queue <- hintr:::Queue$new(workers = workers)
withr::defer_parent({
message("cleaning up workers")
queue$cleanup()
})
queue
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.