From f686b2d6dfff2d10f046a62c3ec2020b221c7045 Mon Sep 17 00:00:00 2001 From: Hadley Wickham Date: Mon, 4 Nov 2024 08:11:37 -0600 Subject: [PATCH] Update internal uses of deprecated mocking functions --- tests/testthat/test-examples.R | 2 +- tests/testthat/test-reporter-debug.R | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/testthat/test-examples.R b/tests/testthat/test-examples.R index efafbf0f4..b584857c5 100644 --- a/tests/testthat/test-examples.R +++ b/tests/testthat/test-examples.R @@ -1,7 +1,7 @@ test_that("test_examples works with installed packages", { local_edition(2) - local_mock(test_rd = identity) + local_mocked_bindings(test_rd = identity) expect_true(length(test_examples()) > 1) }) diff --git a/tests/testthat/test-reporter-debug.R b/tests/testthat/test-reporter-debug.R index b043ebc68..34aab7200 100644 --- a/tests/testthat/test-reporter-debug.R +++ b/tests/testthat/test-reporter-debug.R @@ -1,7 +1,7 @@ test_that("produces consistent output", { withr::local_options(testthat.edition_ignore = TRUE) local_edition(2) - local_mock( + local_mocked_bindings( show_menu = function(choices, title = NULL) { cat(paste0(format(seq_along(choices)), ": ", choices, sep = "\n"), "\n", sep = "") 0L @@ -22,7 +22,7 @@ get_frame_from_debug_reporter <- function(choice, fun, envir = parent.frame()) { force(choice) test_debug_reporter_parent_frame <- NULL - with_mock( + with_mocked_bindings( show_menu = function(choices, title = NULL) { # if (choice > 0) print(choices) my_choice <- choice @@ -178,4 +178,3 @@ test_that("browser() is called for the correct frame for skips", { expect_equal(get_vars_from_debug_reporter(3, fun_3), "g") expect_equal(get_vars_from_debug_reporter(4, fun_3), character()) }) -