Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rely on load_all() to load helpers #1983

Merged
merged 3 commits into from
Oct 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading