Skip to content

Commit

Permalink
Rely on load_all() to load helpers (#1983)
Browse files Browse the repository at this point in the history
Otherwise effectively unload them for the developer. Fixes #1982
  • Loading branch information
hadley authored Oct 23, 2024
1 parent 35b81f1 commit 75c70e0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion R/test-files.R
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,15 @@ test_files_serial <- function(test_dir,
load_package = c("none", "installed", "source"),
error_call = caller_env()) {

# Because load_all() called by test_files_setup_env() will have already
# loaded them. We don't want to rely on testthat's loading since that
# only affects the test environment and we want to keep the helpers
# loaded in the user's session.
load_package <- arg_match(load_package)
if (load_package == "source") {
load_helpers <- FALSE
}

env <- test_files_setup_env(test_package, test_dir, load_package, env)
# record testing env for mocks
local_testing_env(env)
Expand Down Expand Up @@ -244,7 +253,7 @@ test_files_setup_env <- function(test_package,
}

find_load_all_args <- function(path) {
default <- list(export_all = TRUE, helpers = FALSE)
default <- list(export_all = TRUE, helpers = TRUE)

desc <- find_description(path)
if (is.null(desc)) {
Expand Down

0 comments on commit 75c70e0

Please sign in to comment.