Skip to content

Commit 9a951a2

Browse files
TESTS: Add add-on tests for future.apply and doFuture
1 parent 180d8ab commit 9a951a2

File tree

4 files changed

+29
-2
lines changed

4 files changed

+29
-2
lines changed

DESCRIPTION

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ Suggests:
1515
notifier,
1616
pbmcapply,
1717
plyr,
18-
progress
18+
progress,
19+
future.apply,
20+
doFuture
1921
Remotes:
2022
gaborcsardi/notifier@d92b1b6
2123
URL: https://github.com/HenrikBengtsson/progressr

tests/zzz,doFuture.R

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
library(progressr)
2+
options(progressr.interval = 0.0, progressr.delay = 0.01)
3+
4+
if (requireNamespace("doFuture", quietly = TRUE)) {
5+
library("doFuture", character.only = TRUE)
6+
registerDoFuture()
7+
with_progress({
8+
y <- foreach(x = 1:10) %dopar% {
9+
slow_sum(x, stdout=TRUE, message=TRUE)
10+
}
11+
})
12+
}

tests/zzz,future.apply.R

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
library(progressr)
2+
options(progressr.interval = 0.0, progressr.delay = 0.01)
3+
4+
if (requireNamespace("future.apply", quietly = TRUE)) {
5+
with_progress({
6+
y <- future.apply::future_lapply(1:10, function(x) {
7+
slow_sum(x, stdout=TRUE, message=TRUE)
8+
})
9+
})
10+
}

tests/zzz,plyr.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
library(progressr)
2+
options(progressr.interval = 0.0, progressr.delay = 0.01)
23

34
if (requireNamespace("plyr", quietly = TRUE)) {
45
with_progress({
5-
y <- plyr::l_ply(1:10, function(...) Sys.sleep(0.01), .progress = "progressr")
6+
y <- plyr::l_ply(1:10, function(x, ...) {
7+
slow_sum(x, stdout=TRUE, message=TRUE)
8+
}, .progress = "progressr")
69
})
710
}

0 commit comments

Comments
 (0)