Skip to content

Commit

Permalink
Update tests, add warning for versions
Browse files Browse the repository at this point in the history
  • Loading branch information
andrjohns committed Jan 5, 2025
1 parent 7ff206d commit e6aeb27
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 7 additions & 0 deletions R/install.R
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ install_cmdstan <- function(dir = NULL,
} else {
.cmdstanr$WSL <- FALSE
}
if (os_is_windows() && !os_is_wsl() && version < "2.35.0") {
if (Sys.getenv("CMDSTANR_USE_MSYS_TOOLCHAIN") == "") {
stop("CmdStan versions prior to 2.35.0 require additional toolchain configuration on Windows.\n",
"Please set the environment variable CMDSTANR_USE_MSYS_TOOLCHAIN to 'true' and \n",
"call `check_cmdstan_toolchain(fix = TRUE)` before installing CmdStan.", call. = FALSE)
}
}
if (check_toolchain) {
check_cmdstan_toolchain(fix = FALSE, quiet = quiet)
}
Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/test-install.R
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ test_that("install_cmdstan() works with version and release_url", {
expect_message(
expect_output(
install_cmdstan(dir = dir, overwrite = TRUE, cores = 4,
release_url = "https://github.com/stan-dev/cmdstan/releases/download/v2.33.0/cmdstan-2.33.0.tar.gz",
release_url = "https://github.com/stan-dev/cmdstan/releases/download/v2.33.0/cmdstan-2.35.0.tar.gz",
wsl = os_is_wsl()),
"Compiling, linking C++ code",
fixed = TRUE
Expand All @@ -110,7 +110,7 @@ test_that("install_cmdstan() works with version and release_url", {
expect_message(
expect_output(
install_cmdstan(dir = dir, overwrite = TRUE, cores = 4,
version = "2.33.0",
version = "2.35.0",
# the URL is intentionally invalid to test that the version has higher priority
release_url = "https://github.com/stan-dev/cmdstan/releases/download/v2.27.3/cmdstan-2.27.3.tar.gz",
wsl = os_is_wsl()),
Expand Down Expand Up @@ -254,10 +254,10 @@ test_that("Install from release file works", {
dir <- tempdir(check = TRUE)
}

destfile = file.path(dir, "cmdstan-2.33.1.tar.gz")
destfile = file.path(dir, "cmdstan-2.35.0.tar.gz")

download_with_retries(
"https://github.com/stan-dev/cmdstan/releases/download/v2.33.1/cmdstan-2.33.1.tar.gz",
"https://github.com/stan-dev/cmdstan/releases/download/v2.35.0/cmdstan-2.35.0.tar.gz",
destfile)

expect_message(
Expand Down

0 comments on commit e6aeb27

Please sign in to comment.