Skip to content

Commit

Permalink
Merge pull request #135 from mrc-ide/mrc-5429
Browse files Browse the repository at this point in the history
Mrc 5429 - warn on "..." specified for null driver in hipercow_init
  • Loading branch information
richfitz authored Jul 9, 2024
2 parents 9319452 + 063f513 commit baac603
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: hipercow
Title: High Performance Computing
Version: 1.0.28
Version: 1.0.29
Authors@R: c(person("Rich", "FitzJohn", role = c("aut", "cre"),
email = "[email protected]"),
person("Wes", "Hinsley", role = "aut"),
Expand Down
4 changes: 4 additions & 0 deletions R/root.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
##' path <- withr::local_tempfile()
##' hipercow_init(path)
hipercow_init <- function(root = ".", driver = NULL, ...) {
if (is.null(driver) && length(list(...)) > 0) {
cli::cli_alert_warning(
"`driver` was not specified, but extra args were detected.")
}
abs_path <- fs::path_abs(root)
norm_path <- fs::path_norm(root)
not_same_path <- (abs_path != norm_path)
Expand Down
2 changes: 1 addition & 1 deletion drivers/windows/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: hipercow.windows
Title: DIDE HPC Support for Windows
Version: 1.0.28
Version: 1.0.29
Authors@R: c(person("Rich", "FitzJohn", role = c("aut", "cre"),
email = "[email protected]"),
person("Wes", "Hinsley", role = "aut"),
Expand Down
11 changes: 11 additions & 0 deletions tests/testthat/test-root.R
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,14 @@ test_that("Report working directory if helpful", {
expect_match(msg, "Initialised hipercow at '.+'\n")

})


test_that("Extraneous args are warned about", {
path <- withr::local_tempdir()
withr::with_dir(path,
res <- testthat::evaluate_promise(
hipercow_init(potato = TRUE, turnip = 42))
)
expect_length(res$messages, 3)
expect_match(res$messages[1], "`driver` was not specified, but")
})

0 comments on commit baac603

Please sign in to comment.