From b1ae937aaba19091c9f6c7827c3b4c3b8d829d14 Mon Sep 17 00:00:00 2001 From: David Klein Date: Thu, 10 Oct 2024 11:43:48 +0200 Subject: [PATCH] Revert unintended changes from previous commit in updateInputData.R and commit what was actually intended in test_01-inputdata.R --- scripts/start/updateInputData.R | 2 +- tests/testthat/test_01-inputdata.R | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/start/updateInputData.R b/scripts/start/updateInputData.R index 31c54f227..8f1dd6d39 100644 --- a/scripts/start/updateInputData.R +++ b/scripts/start/updateInputData.R @@ -21,7 +21,7 @@ updateInputData <- function(cfg, remindPath = ".", gamsCompile = FALSE) { } regicode <- madrat::regionscode(file.path(remindPath, cfg$regionmapping)) input_new <- c(paste0("rev",cfg$inputRevision,"_",regicode,"_", tolower(cfg$model_name),".tgz"), - paste0("rev",cfg$inputRevision,"_",regicode,ifelse(cfg$extramappings_historic == "","",paste0("-", madrat::regionscode(cfg$extramappings_historic))),"_", tolower(cfg$validationmodel_name),".tzz"), + paste0("rev",cfg$inputRevision,"_",regicode,ifelse(cfg$extramappings_historic == "","",paste0("-", madrat::regionscode(cfg$extramappings_historic))),"_", tolower(cfg$validationmodel_name),".tgz"), paste0("CESparametersAndGDX_",cfg$CESandGDXversion,".tgz")) # Specify for each element of input_new whether to stop if the respective file could not be downloaded diff --git a/tests/testthat/test_01-inputdata.R b/tests/testthat/test_01-inputdata.R index f76448cd8..40911680d 100644 --- a/tests/testthat/test_01-inputdata.R +++ b/tests/testthat/test_01-inputdata.R @@ -8,9 +8,16 @@ test_that("Are all input data files present?", { missinginput <- missingInputData(path = "../..") if (length(missinginput) > 0) { lockID <- gms::model_lock(folder = "../..") - updateInputData(cfg = gms::readDefaultConfig("../.."), remindPath = "../..") + w <- capture_warning(updateInputData(cfg = gms::readDefaultConfig("../.."), remindPath = "../..")) + # ignore warning about missing historical.mif, raise warning if there were other wargnings + ignore <- "File historical.mif seems to be missing!" + if (!w$message %in% ignore) { + warning(paste0("'updateInputData' raised the following wargnings\n", paste(w, collapse = "\n"))) + } gms::model_unlock(lockID) missinginput <- missingInputData(path = "../..") + # remove historical.mif since it is optional + missinginput <- grep("historical.mif", missinginput, invert = TRUE, value = TRUE) if (length(missinginput) > 0) { warning("Missing input files: ", paste(missinginput, collapse = ", ")) }