Skip to content

Commit

Permalink
suppress more output during tests to clean up logs
Browse files Browse the repository at this point in the history
  • Loading branch information
jgabry committed Nov 27, 2024
1 parent 591b4ab commit acc3577
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 6 additions & 3 deletions tests/testthat/test-failed-chains.R
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,12 @@ test_that("gq chains error on wrong input CSV", {
mod <- testing_model("bernoulli_ppc")
data_list <- testing_data("bernoulli_ppc")
suppressWarnings(
expect_message(
mod$generate_quantities(data = data_list, fitted_params = fit_logistic$output_files()),
"Mismatch between model and fitted_parameters csv"
expect_output(
expect_message(
mod$generate_quantities(data = data_list, fitted_params = fit_logistic$output_files()),
"Mismatch between model and fitted_parameters csv"
),
"Running standalone generated quantities"
)
)
expect_warning(
Expand Down
4 changes: 3 additions & 1 deletion tests/testthat/test-fit-mcmc.R
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,9 @@ test_that("loo method works with moment-matching", {
# Moment-matching needs model-methods, so make sure hpp is available
mod <- cmdstan_model(testing_stan_file("loo_moment_match"), force_recompile = TRUE)
data_list <- testing_data("loo_moment_match")
fit <- mod$sample(data = data_list, chains = 1, seed = 1000)
utils::capture.output(
fit <- mod$sample(data = data_list, chains = 1, seed = 1000)
)

# Regular loo should warn that some pareto-k are "too high"
expect_warning(
Expand Down

0 comments on commit acc3577

Please sign in to comment.