From 3a05c065dc116f51ef3a869a95f719c53fd9b825 Mon Sep 17 00:00:00 2001 From: Sebastian Funk Date: Tue, 10 Oct 2023 23:40:12 +0100 Subject: [PATCH] improve testing output --- tests/testthat/setup.R | 2 ++ tests/testthat/test-estimate_secondary.R | 1 - tests/testthat/test-estimate_truncation.R | 12 ++++-------- tests/testthat/test-simulate_infections.R | 1 - 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/tests/testthat/setup.R b/tests/testthat/setup.R index 4c5261438..46c7a2e83 100644 --- a/tests/testthat/setup.R +++ b/tests/testthat/setup.R @@ -1,3 +1,5 @@ +library("data.table") + if (identical(Sys.getenv("NOT_CRAN"), "true")) { files <- c( "convolve.stan", "pmfs.stan", "observation_model.stan", "secondary.stan", diff --git a/tests/testthat/test-estimate_secondary.R b/tests/testthat/test-estimate_secondary.R index 948538f1b..880ccd285 100644 --- a/tests/testthat/test-estimate_secondary.R +++ b/tests/testthat/test-estimate_secondary.R @@ -1,5 +1,4 @@ skip_on_cran() -library(data.table) #### Incidence data example #### diff --git a/tests/testthat/test-estimate_truncation.R b/tests/testthat/test-estimate_truncation.R index 7ba12b668..dad8f4b12 100644 --- a/tests/testthat/test-estimate_truncation.R +++ b/tests/testthat/test-estimate_truncation.R @@ -44,8 +44,7 @@ test_that("estimate_truncation can return values from simulated data and plot them", { # fit model to example data est <- estimate_truncation(example_data, - verbose = interactive(), refresh = 0, - chains = 2, iter = 1000, warmup = 250 + verbose = FALSE, chains = 2, iter = 1000, warmup = 250 ) expect_equal( names(est), @@ -58,16 +57,13 @@ test_that("estimate_truncation can return values from simulated data and plot test_that("deprecated arguments are recognised", { options(warn = 2) expect_error(estimate_truncation(example_data, - verbose = interactive(), refresh = 0, - trunc_max = 10 + verbose = FALSE, trunc_max = 10 ), "deprecated") expect_error(estimate_truncation(example_data, - verbose = interactive(), refresh = 0, - max_truncation = 10 + verbose = FALSE, max_truncation = 10 ), "deprecated") expect_error(estimate_truncation(example_data, - verbose = interactive(), refresh = 0, - trunc_dist = "lognormal" + verbose = FALSE, trunc_dist = "lognormal" ), "deprecated") }) diff --git a/tests/testthat/test-simulate_infections.R b/tests/testthat/test-simulate_infections.R index f900557b9..422788db6 100644 --- a/tests/testthat/test-simulate_infections.R +++ b/tests/testthat/test-simulate_infections.R @@ -9,7 +9,6 @@ reporting_delay <- dist_spec( sd = convert_to_logsd(2, 1), sd_sd = 0.1, max = 10 ) -library(data.table) out <- suppressWarnings(estimate_infections(reported_cases, generation_time = generation_time_opts(generation_time), delays = delay_opts(reporting_delay),