Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
sebffischer committed Oct 16, 2024
1 parent 30c65ab commit b039531
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tests/testthat/test_with_torch_settings.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,11 @@ test_that("interop threads work", {
library(torch)
with_torch_settings = getFromNamespace("with_torch_settings", "mlr3torch")
with_torch_settings(NULL, 1, 2, invisible(NULL))
x1 = capture.output(with_torch_settings(NULL, 1, 2, invisible(NULL)))
x2 = capture.output(with_torch_settings(NULL, 1, 1, invisible(NULL)))
list(x1, x2)
x1 = tryCatch(with_torch_settings(NULL, 1, 2, invisible(NULL)), warning = identity)$message
x2 = tryCatch(with_torch_settings(NULL, 1, 1, invisible(NULL)), warning = identity)$message
list(x1, x2, torch_get_num_interop_threads())
})
expect_equal(result[[1]], character(0))
expect_true(length(result[[1]]) == 0)
expect_true(grepl("keeping the previous value 2", result[[2]], fixed = TRUE))
expect_equal(result[[3]], 2)
})

0 comments on commit b039531

Please sign in to comment.