Skip to content

Commit 8187059

Browse files
TESTS: Add test stubs for doFuture, future, and furrr
1 parent a48a3dd commit 8187059

File tree

5 files changed

+15
-17
lines changed

5 files changed

+15
-17
lines changed

DESCRIPTION

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Suggests:
1616
pbmcapply,
1717
plyr,
1818
progress,
19-
## For testing purposes:
2019
doFuture,
2120
future.apply,
2221
furrr
@@ -26,4 +25,3 @@ URL: https://github.com/HenrikBengtsson/progressr
2625
BugReports: https://github.com/HenrikBengtsson/progressr/issues
2726
RoxygenNote: 6.1.1
2827
Roxygen: list(markdown = TRUE)
29-

tests/zzz,doFuture.R

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

44
if (requireNamespace("doFuture", quietly = TRUE)) {
55
library("doFuture", character.only = TRUE)
66
registerDoFuture()
77
with_progress({
8-
p <- progressor(10)
9-
y <- foreach(x = 1:10) %dopar% {
8+
p <- progressor(4)
9+
y <- foreach(n = 3:6) %dopar% {
1010
p()
11-
slow_sum(x, stdout=TRUE, message=TRUE)
11+
slow_sum(1:n, stdout=TRUE, message=TRUE)
1212
}
1313
})
1414
}

tests/zzz,furrr.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
library(progressr)
2-
options(progressr.interval = 0.0, progressr.delay = 0.01)
2+
options(progressr.interval = 0.0, delay = 0.1)
33

44
if (requireNamespace("furrr", quietly = TRUE)) {
55
with_progress({
6-
p <- progressor(10)
7-
y <- furrr::future_map(1:10, function(x) {
6+
p <- progressor(4)
7+
y <- furrr::future_map(3:6, function(n) {
88
p()
9-
slow_sum(x, stdout=TRUE, message=TRUE)
9+
slow_sum(1:n, stdout=TRUE, message=TRUE)
1010
})
1111
})
1212
}

tests/zzz,future.apply.R

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

44
if (requireNamespace("future.apply", quietly = TRUE)) {
55
with_progress({
6-
p <- progressor(10)
7-
y <- future.apply::future_lapply(1:10, function(x) {
6+
p <- progressor(4)
7+
y <- future.apply::future_lapply(3:6, function(n) {
88
p()
9-
slow_sum(x, stdout=TRUE, message=TRUE)
9+
slow_sum(1:n, stdout=TRUE, message=TRUE)
1010
})
1111
})
1212
}

tests/zzz,plyr.R

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

44
if (requireNamespace("plyr", quietly = TRUE)) {
55
with_progress({
6-
y <- plyr::l_ply(1:10, function(x, ...) {
7-
slow_sum(x, stdout=TRUE, message=TRUE)
6+
y <- plyr::l_ply(3:6, function(n, ...) {
7+
slow_sum(1:n, stdout=TRUE, message=TRUE)
88
}, .progress = "progressr")
99
})
1010
}

0 commit comments

Comments
 (0)