Skip to content

Commit

Permalink
be more careful skipping setup
Browse files Browse the repository at this point in the history
  • Loading branch information
seabbs committed Oct 23, 2024
1 parent d1fea59 commit 62bb6c3
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions tests/testthat/setup.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,21 @@ options(datatable.print.keys = FALSE)
if (
!on_ci() || (on_ci() && Sys.info()["sysname"] == "Linux" && not_on_cran())
) {
library(cmdstanr) # nolint
temp_path <- file.path(tempdir(), "pcd_stan_functions.stan")
stan_functions <- pcd_load_stan_functions(
wrap_in_block = TRUE,
write_to_file = TRUE,
output_file = temp_path
)
model <- suppressMessages(suppressWarnings(cmdstanr::cmdstan_model( # nolint
temp_path
)))
model$expose_functions(global = TRUE)
if (requireNamespace("cmdstanr", quietly = TRUE)) { # nolint
if (!is.null(cmdstanr::cmdstan_version())) { # nolint
library(cmdstanr) # nolint
temp_path <- file.path(tempdir(), "pcd_stan_functions.stan")
stan_functions <- pcd_load_stan_functions(
wrap_in_block = TRUE,
write_to_file = TRUE,
output_file = temp_path
)
model <- suppressMessages(suppressWarnings(
cmdstanr::cmdstan_model( # nolint
temp_path
)
))
model$expose_functions(global = TRUE)
}
}
}

0 comments on commit 62bb6c3

Please sign in to comment.