R version 4.6.0 RC (2026-04-22 r89945 ucrt) -- "Because it was There" Copyright (C) 2026 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > #! /usr/bin/env Rscript > ## This runs testme test script inst/testme/test-globals,manual.R > ## Don't edit - it was autogenerated by inst/testme/deploy.R > future.batchtools:::testme("globals,manual") Test 'globals,manual' ... chr "none" > library(future) > plan(future.batchtools::batchtools_local) > message("*** Globals - manually ...") *** Globals - manually ... > message("*** Globals manually specified as named list ...") *** Globals manually specified as named list ... > globals <- list(a = 1, b = 2, sumtwo = function(x) x[1] + + x[2]) > attach_locally(globals) > v0 <- local({ + x <- 1:10 + sumtwo(a + b * x) + }) > message("*** Globals - automatic ...") *** Globals - automatic ... > attach_locally(globals) > f <- future({ + x <- 1:10 + sumtwo(a + b * x) + }, globals = TRUE) > rm(list = names(globals)) > y <- value(f) > print(y) [1] 8 > stopifnot(all.equal(y, v0)) > attach_locally(globals) > y %<-% { + x <- 1:10 + sumtwo(a + b * x) + } %globals% TRUE > rm(list = names(globals)) > print(y) [1] 8 > stopifnot(all.equal(y, v0)) > y %<-% { + 1 + } %globals% FALSE > print(y) [1] 1 > stopifnot(identical(y, 1)) > attach_locally(globals) > f <- future({ + x <- 1:10 + sumtwo(a + b * x) + }, globals = FALSE) > rm(list = names(globals)) > y <- tryCatch(value(f), error = identity) Warning in delete.BatchtoolsFuture(future) : Will not remove batchtools registry, because the status of the batchtools was 'error', 'defined', 'finished', 'started', 'submitted' and future backend argument 'delete' is 'on-success': 'D:/temp/2026_04_25_00_50_17_18966/RtmpKgn5Yr/.future/20260425_005215-Kgn5Yr/batchtools_1663031387' > if (!inherits(f, c("SequentialFuture", "MulticoreFuture"))) { + stopifnot(inherits(y, "error")) + } > message("*** Globals - automatic ... DONE") *** Globals - automatic ... DONE > message("*** Globals manually specified as named list ...") *** Globals manually specified as named list ... > rm(list = names(globals)) Warning in rm(list = names(globals)) : object 'a' not found Warning in rm(list = names(globals)) : object 'b' not found Warning in rm(list = names(globals)) : object 'sumtwo' not found > f <- future({ + x <- 1:10 + sumtwo(a + b * x) + }, globals = globals) > v <- value(f) > print(v) [1] 8 > stopifnot(all.equal(v, v0)) > y %<-% { + x <- 1:10 + sumtwo(a + b * x) + } %globals% globals > print(y) [1] 8 > stopifnot(all.equal(y, v0)) > message("*** Globals manually specified as named list ... DONE") *** Globals manually specified as named list ... DONE > message("*** Globals manually specified by their names ...") *** Globals manually specified by their names ... > attach_locally(globals) > f <- future({ + x <- 1:10 + sumtwo(a + b * x) + }, globals = c("a", "b", "sumtwo")) > rm(list = names(globals)) > v <- value(f) > print(v) [1] 8 > stopifnot(all.equal(v, v0)) > attach_locally(globals) > y %<-% { + x <- 1:10 + sumtwo(a + b * x) + } %globals% c("a", "b", "sumtwo") > rm(list = names(globals)) > print(y) [1] 8 > stopifnot(all.equal(y, v0)) > message("*** Globals manually specified by their names ... DONE") *** Globals manually specified by their names ... DONE > message("*** Globals - manually ... DONE") *** Globals - manually ... DONE Failed to undo environment variables: - Expected environment variables: [n=220] '!ExitCode', 'ALLUSERSPROFILE', 'APPDATA', ..., 'tempdirname' - Environment variables still there: [n=0] - Environment variables missing: [n=1] 'MAKEFLAGS' Differences environment variable by environment variable: Skipping, because path appears not to be an 'R CMD check' folder: 'D:/temp/2026_04_25_00_50_17_18966' Test time: user.self=1s, sys.self=0.1s, elapsed=8s, user.child=NAs, sys.child=NAs Test 'tempdirname' ... success Warning message: In delete.BatchtoolsFuture(f, onRunning = "skip", onMissing = "ignore", : Will not remove batchtools registry, because the status of the batchtools was 'error', 'defined', 'finished', 'started', 'submitted' and future backend argument 'delete' is 'on-success': 'D:/temp/2026_04_25_00_50_17_18966/RtmpKgn5Yr/.future/20260425_005215-Kgn5Yr/batchtools_1663031387' > > proc.time() user system elapsed 1.67 0.35 8.29