Skip to content

Commit 4a26a7a

Browse files
committed
Temporary check for devtools::load_all()
Until we have a better way of checking for it within helper files
1 parent 4bd5563 commit 4a26a7a

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

tests/testthat/helper-mock.R

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,21 @@ skip_old_freetype <- function() {
2323
}
2424
}
2525

26-
if (!old_freetype() && !on_load()) {
26+
27+
28+
stack <- rev(rlang::ctxt_stack())
29+
30+
is_load_all <- function(frame) {
31+
if (rlang::is_lang(frame$expr, "load_all")) {
32+
identical(frame$fn, devtools::load_all)
33+
} else {
34+
FALSE
35+
}
36+
}
37+
38+
on_load <- purrr::some(stack, is_load_all)
39+
40+
if (!old_freetype() && !on_load) {
2741
mock_pkg_dir <- create_mock_pkg()
2842
mock_test_dir <- file.path(mock_pkg_dir, "tests", "testthat")
2943

0 commit comments

Comments
 (0)