Skip to content

Commit

Permalink
Work around issue stan-dev#239 in the tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
fweber144 committed Apr 20, 2022
1 parent 445c046 commit dbf492f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions tests/testthat/setup.R
Original file line number Diff line number Diff line change
Expand Up @@ -786,11 +786,21 @@ if (run_cvvs) {
# diagnostics. Additionally to suppressWarnings(), suppressMessages() could be
# used here (because of the refits in K-fold CV):
cvvss <- suppressWarnings(lapply(args_cvvs, function(args_cvvs_i) {
do.call(cv_varsel, c(
cvvs_expr <- expression(do.call(cv_varsel, c(
list(object = refmods[[args_cvvs_i$tstsetup_ref]]),
excl_nonargs(args_cvvs_i)
))
)))
if (args_cvvs_i$mod_nm == "gamm" &&
!identical(args_cvvs_i$cv_method, "kfold")) {
# Due to issue #239, we have to wrap the call to cv_varsel() in try():
return(try(eval(cvvs_expr), silent = TRUE))
} else {
return(eval(cvvs_expr))
}
}))
success_cvvs <- !sapply(cvvss, inherits, "try-error")
cvvss <- cvvss[success_cvvs]
args_cvvs <- args_cvvs[success_cvvs]
}

## Projection -------------------------------------------------------------
Expand Down

0 comments on commit dbf492f

Please sign in to comment.