Skip to content

Commit 377b7cf

Browse files
authored
Temporarily disable expect_error() tests that cause workers to leak (#308)
1 parent def4c72 commit 377b7cf

5 files changed

Lines changed: 60 additions & 27 deletions

File tree

tests/testthat/helper-state.R

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Detects leaked workers in tests, which show up as:
2+
#
3+
# ```
4+
# Warning message:
5+
# In .Internal(gc(verbose, reset, full)) :
6+
# closing unused connection 4 (<-localhost:11913)
7+
# ```
8+
#
9+
# If a leaked connection is detected, a warning is thrown by testthat for
10+
# the problematic test.
11+
#
12+
# We keep this on constantly to ensure we aren't leaking connections. It has
13+
# also been helpful for detecting future issues around leaked workers (#307).
14+
set_state_inspector(function() {
15+
getAllConnections()
16+
})

tests/testthat/test-furrr-options.R

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,12 @@ test_that("can selectively export packages on multisession", {
7070

7171
opts <- furrr_options(packages = "dplyr")
7272

73-
expect_error(
74-
future_map(1:2, ~ tibble(x = .x))
75-
)
73+
# TODO: Reenable this test after future issue is fixed
74+
# https://github.com/futureverse/future/issues/820
75+
# https://github.com/futureverse/furrr/issues/307
76+
# expect_error(
77+
# future_map(1:2, ~ tibble(x = .x))
78+
# )
7679

7780
expect_identical(
7881
future_map(1:2, ~ tibble(x = .x), .options = opts),

tests/testthat/test-future-map.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,11 @@ furrr_test_that("`.f` globals are only looked up in the function env of `.f` (#1
278278
future_map(1:2, f)
279279
}
280280

281-
expect_error(wrapper(fn), "'y' not found")
281+
# TODO: Reenable this test after future issue is fixed
282+
# https://github.com/futureverse/future/issues/820
283+
# https://github.com/futureverse/furrr/issues/307
284+
# expect_error(wrapper(fn), "'y' not found")
285+
282286
expect_identical(wrapper(fn2), list(-1, -1))
283287
})
284288

tests/testthat/test-future-map2.R

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -186,17 +186,20 @@ furrr_test_that("size one recycling works", {
186186
)
187187
})
188188

189-
furrr_test_that("generally can't recycle to size zero", {
190-
expect_error(
191-
future_map2(1:2, integer(), ~ c(.x, .y)),
192-
"Can't recycle"
193-
)
194-
195-
expect_error(
196-
future_map2(integer(), 1:2, ~ c(.x, .y)),
197-
"Can't recycle"
198-
)
199-
})
189+
# TODO: Reenable this test after future issue is fixed
190+
# https://github.com/futureverse/future/issues/820
191+
# https://github.com/futureverse/furrr/issues/307
192+
# furrr_test_that("generally can't recycle to size zero", {
193+
# expect_error(
194+
# future_map2(1:2, integer(), ~ c(.x, .y)),
195+
# "Can't recycle"
196+
# )
197+
#
198+
# expect_error(
199+
# future_map2(integer(), 1:2, ~ c(.x, .y)),
200+
# "Can't recycle"
201+
# )
202+
# })
200203

201204
# ------------------------------------------------------------------------------
202205
# Miscellaneous

tests/testthat/test-future-pmap.R

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -189,17 +189,20 @@ furrr_test_that("size one recycling works", {
189189
)
190190
})
191191

192-
furrr_test_that("generally can't recycle to size zero", {
193-
expect_error(
194-
future_pmap(list(1:2, integer()), ~ c(.x, .y)),
195-
"Can't recycle"
196-
)
197-
198-
expect_error(
199-
future_pmap(list(integer(), 1:2), ~ c(.x, .y)),
200-
"Can't recycle"
201-
)
202-
})
192+
# TODO: Reenable this test after future issue is fixed
193+
# https://github.com/futureverse/future/issues/820
194+
# https://github.com/futureverse/furrr/issues/307
195+
# furrr_test_that("generally can't recycle to size zero", {
196+
# expect_error(
197+
# future_pmap(list(1:2, integer()), ~ c(.x, .y)),
198+
# "Can't recycle"
199+
# )
200+
#
201+
# expect_error(
202+
# future_pmap(list(integer(), 1:2), ~ c(.x, .y)),
203+
# "Can't recycle"
204+
# )
205+
# })
203206

204207
# ------------------------------------------------------------------------------
205208
# Miscellaneous
@@ -237,7 +240,11 @@ furrr_test_that("unused components can be absorbed", {
237240
x
238241
}
239242

240-
expect_error(future_pmap_dbl(x, fn1))
243+
# TODO: Reenable this test after future issue is fixed
244+
# https://github.com/futureverse/future/issues/820
245+
# https://github.com/futureverse/furrr/issues/307
246+
# expect_error(future_pmap_dbl(x, fn1))
247+
241248
expect_identical(future_pmap_dbl(x, fn2), c(1, 2))
242249
})
243250

0 commit comments

Comments
 (0)