From 200853591448d6ea3f2baa28d47e9ad7471b7ad6 Mon Sep 17 00:00:00 2001 From: Hadley Wickham Date: Wed, 2 Aug 2023 07:33:51 -0500 Subject: [PATCH] Rely on the testing infrastructure to load helpers (#2530) --- R/test.R | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/R/test.R b/R/test.R index 0fcfccf80..42a30adda 100644 --- a/R/test.R +++ b/R/test.R @@ -38,7 +38,7 @@ test <- function(pkg = ".", filter = NULL, stop_on_failure = FALSE, export_all = cli::cli_inform(c(i = "Testing {.pkg {pkg$package}}")) withr::local_envvar(r_env_vars()) - load_package <- load_package_if_needed(pkg) + load_package <- load_package_for_testing(pkg) testthat::test_local( pkg$path, filter = filter, @@ -67,7 +67,7 @@ test_active_file <- function(file = find_active_file(), ...) { rstudioapi::executeCommand("activateConsole", quiet = TRUE) } - load_package <- load_package_if_needed(pkg) + load_package <- load_package_for_testing(pkg) testthat::test_file( test_files, package = pkg$package, @@ -76,11 +76,11 @@ test_active_file <- function(file = find_active_file(), ...) { ) } -load_package_if_needed <- function(pkg) { +load_package_for_testing <- function(pkg) { if (pkg$package == "testthat") { # Must load testthat outside of testthat so tests are run with # dev testthat - load_all(pkg$path, quiet = TRUE) + load_all(pkg$path, quiet = TRUE, helpers = FALSE) "none" } else { "source"