Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
# Keep the live Stan smoke fit active in CI; it skips on CRAN (#91).
NOT_CRAN: 'true'

steps:
- name: Checkout repository
Expand Down
2 changes: 1 addition & 1 deletion R/hestia_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,7 @@ make_stan_data <- function(
#' [stan_options()] (for example `stan_options(iter = 1000)`).
#' @returns `draws_array` object with chains for each model parameter
#'
#' @examples
#' @examplesIf interactive()
#' # Subset sir package data to 10 households (for speedy example)
#' sir_sub <- sir[sir$hh_id <= 10, ]
#'
Expand Down
11 changes: 6 additions & 5 deletions tests/testthat/test-hestia-smoke.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# End-to-end smoke test. This fits a real (if tiny) Stan model on the bundled
# `sir` data and checks that the pipeline returns sensible, well-named draws.
# It deliberately uses a single short chain so it is cheap enough to run in CI
# on every push (no skip_on_cran()).
# The live fit runs in CI but is skipped on CRAN: even a single short chain
# uses several CPU seconds per elapsed second with Stan's reduce_sum (#91).

test_that("the package and its bundled data are available", {
expect_true(requireNamespace("hestia", quietly = TRUE))
Expand All @@ -13,13 +13,14 @@ test_that("the package and its bundled data are available", {
})

test_that("run_model fits an SIR model end-to-end and returns named draws", {
skip_on_cran()

inf_mod <- sir_infection_model()
obs_mod <- sir_observation_model()
dat <- sir_subset(10)

# A single short chain keeps this cheap enough to run unconditionally (no
# skip_on_cran()) on CRAN's own check machines: run_model()'s init list is
# built dynamically from stan_opts$chains, so chains = 1 is fully supported.
# The init list is built dynamically from stan_opts$chains, so chains = 1 is
# supported while keeping this CI fit short.
suppressWarnings(suppressMessages(
draws <- run_model(
inf_model = inf_mod,
Expand Down
Loading