-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
25 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,6 @@ Imports: | |
testthat | ||
Suggests: | ||
callr, | ||
here, | ||
pkgload, | ||
rstudioapi, | ||
usethis, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
# convoluted way to run the tests | ||
# without their results being reported for the calling test file | ||
run_lazytest <- function(pkg_dir, lazytest_dir) { | ||
withr::with_dir(pkg_dir, { | ||
process <- callr::r_bg( | ||
function(lazytest_dir) { | ||
process <- callr::r_bg( | ||
function(pkg_dir, lazytest_dir) { | ||
# use library for covr and R CMD check | ||
if (isTRUE(as.logical(Sys.getenv("R_COVR", "false"))) || grepl("Rcheck", lazytest_dir)) { | ||
library("lazytest") | ||
} else { | ||
pkgload::load_all(lazytest_dir) | ||
testthat_results <- lazytest::lazytest_local(stop_on_failure = FALSE) | ||
return(testthat_results) | ||
}, | ||
args = list(lazytest_dir = lazytest_dir), | ||
stderr = file.path(pkg_dir, "lazytest-msg") # catching lazytest messages | ||
) | ||
process$wait() | ||
}) | ||
} | ||
|
||
lazytest_dir <- function() { | ||
here::here() | ||
} | ||
testthat_results <- lazytest_local(pkg_dir, stop_on_failure = FALSE) | ||
return(testthat_results) | ||
}, | ||
args = list(pkg_dir = pkg_dir, lazytest_dir = lazytest_dir), | ||
stderr = file.path(pkg_dir, "lazytest-msg") # catching lazytest messages | ||
) | ||
process$wait() | ||
} | ||
|
||
lazytest_dir <- find.package("lazytest") | ||
executed_test_files <- function(callr_output) { | ||
as.data.frame.testthat_results(callr_output$get_result())[,1] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters