Skip to content

Commit f970845

Browse files
Now future.tests::check("mirai::daemons(2); plan(future.mirai::mirai_cluster)") works
1 parent a73da23 commit f970845

File tree

5 files changed

+10
-2
lines changed

5 files changed

+10
-2
lines changed

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ importFrom(crayon,silver)
3232
importFrom(crayon,yellow)
3333
importFrom(future,availableCores)
3434
importFrom(future,plan)
35+
importFrom(future,resetWorkers)
3536
importFrom(future,sequential)
3637
importFrom(grDevices,dev.list)
3738
importFrom(grDevices,dev.off)

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
* Now `load_tests()` returns a named list, where the names
66
corresponds to the test titles.
77

8+
* Now `future.tests::check("mirai::daemons(2);
9+
plan(future.mirai::mirai_cluster)")` works.
10+
811
## Test Updates
912

1013
* Remove `plan()` test on legacy `constant` backend.

R/check.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,9 @@ check <- function(plan = NULL, tags = character(), timeout = NULL, settings = TR
109109
if (is.character(plan) && length(plan) >= 1L) {
110110
plan <- unique(plan)
111111
for (value in plan) {
112-
if (!grepl("^plan(.*)$", value)) value <- sprintf("plan(%s)", value)
112+
if (!grepl("plan(.*)$", value)) {
113+
value <- sprintf("plan(%s)", value)
114+
}
113115
expr <- parse(text = value)
114116
add_test_plan(expr, substitute = FALSE)
115117
}

R/run_test.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#'
1717
#' @return Value of test expression and benchmark information.
1818
#'
19+
#' @importFrom future resetWorkers plan
1920
#' @export
2021
run_test <- function(test, envir = parent.frame(), local = TRUE, args = list(), defaults = list(), output = "stdout+stderr", timeout = getOption("future.tests.timeout", 30)) {
2122
stopifnot(inherits(test, "Test"))
@@ -54,7 +55,7 @@ run_test <- function(test, envir = parent.frame(), local = TRUE, args = list(),
5455
on.exit(pop_state())
5556

5657
if (test$reset_workers) {
57-
future::resetWorkers(plan())
58+
resetWorkers(plan())
5859
}
5960

6061
res <- evaluate_expr(test$expr, envir = envir, local = FALSE, output = output, timeout = timeout)

inst/test-db/resolve.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ make_test(title = "resolve()", args = list(lazy = c(FALSE, TRUE), result = c(FAL
44
list(a = 1, b = 42L)
55
}, lazy = lazy)
66
res <- resolve(f, result = result, recursive = recursive)
7+
78
stopifnot(identical(res, f))
89
})
910

0 commit comments

Comments
 (0)