Skip to content

Commit

Permalink
patch for interactively testing covr (trying with older Metworx BP)
Browse files Browse the repository at this point in the history
  • Loading branch information
barrettk committed Sep 9, 2024
1 parent dbf07a9 commit 5fafe08
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
12 changes: 6 additions & 6 deletions R/coverage.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
#' The basename of `out_dir` should be the package name and version pasted together
#'
#' @keywords internal
add_coverage <- function(pkg_source_path, out_dir, timeout = Inf) {
add_coverage <- function(pkg_source_path, out_dir, timeout = Inf, ...) {
# run covr
pkg_name <- basename(out_dir)

res_cov <- tryCatch({
coverage_list <- run_covr(pkg_source_path, timeout)
coverage_list <- run_covr(pkg_source_path, timeout, ...)

# If no testable functions are found in the package, `filecoverage` and `totalcoverage`
# will yield logical(0) and NaN respectively. Coerce to usable format
Expand Down Expand Up @@ -66,12 +66,12 @@ add_coverage <- function(pkg_source_path, out_dir, timeout = Inf) {
#' Run covr in subprocess with timeout
#'
#' @noRd
run_covr <- function(path, timeout) {
run_covr <- function(path, timeout, ...) {
callr::r_safe(
function(p) {
covr::coverage_to_list(covr::package_coverage(p, type = "tests"))
function(p, ...) {
covr::coverage_to_list(covr::package_coverage(p, type = "tests", ...))
},
args = list(path),
args = list(path, ...),
libpath = .libPaths(),
repos = NULL,
package = FALSE,
Expand Down
4 changes: 2 additions & 2 deletions pkgr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ Packages:
- styler

Repos:
- CRAN: https://cran.rstudio.com
- MPN: https://mpn.metworx.com/snapshots/stable/2022-10-20 # used for metrum packages
- MPN: https://mpn.metworx.com/snapshots/stable/2024-03-01 # used for metrum packages

Lockfile:
Type: renv


Rpath: ${R_EXE_4_1}
1 change: 1 addition & 0 deletions tests/testthat/test-results.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
describe("covr and rcmdcheck success", {

it("no rcmdcheck warnings", {
browser()
local_check_envvar()
# Create temp package that will succeed
pkg_setup <- pkg_dirs$pkg_setups_df %>% dplyr::filter(pkg_type == "pass_success")
Expand Down

0 comments on commit 5fafe08

Please sign in to comment.