diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b17c20297ab32024162dee46940b5bf65d41d310..4b1828ba0745a86928138167e60cd1cbb30f4681 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -40,6 +40,10 @@ default: - Rscript -e 'source("tests/testthat/store_examples.R"); StoreRefExampleResults("airGR");' - R CMD INSTALL . - Rscript -e 'source("tests/testthat/store_examples.R"); StoreTestExampleResults("airGR");' + artifacts: + paths: + - tests/tmp/ + expire_in: 1 week .check_not_cran: stage: tests diff --git a/tests/testthat/store_examples.R b/tests/testthat/store_examples.R index ef3632eae3beb3b6f9e71d1be269942079cae2f8..6a7b8e31a1d6174045718c86a86764692765de6b 100644 --- a/tests/testthat/store_examples.R +++ b/tests/testthat/store_examples.R @@ -4,7 +4,11 @@ StoreRefExampleResults <- function(package, ...) { } StoreTestExampleResults <- function(package, ...) { - StoreExampleResults(package = package, path = "tests/tmp/test", ...) + StoreExampleResults( + package = package, + path = file.path("tests/tmp", Sys.getenv("R_VERSION", "test")), + ... + ) } #' Run examples of a package and store the output variables in RDS files for further testing. diff --git a/tests/testthat/test-regression.R b/tests/testthat/test-regression.R index 1c41c9400214e6e75d34886a7655085f05a63c02..866fcdfece05d0355ead2a23added080592d4730 100644 --- a/tests/testthat/test-regression.R +++ b/tests/testthat/test-regression.R @@ -8,7 +8,10 @@ CompareWithRef <- function(refVarFile, testDir, regIgnore) { if(is.null(regIgnore) || all(apply(regIgnore, 1, function(x) {!all(x == v)}))) { test_that(paste("Compare", v$topic, v$var), { skip_on_cran() - testVarFile <- paste0("../tmp/test/", file.path(v$topic, v$var), ".rds") + testVarFile <- paste0( + file.path("../tmp", Sys.getenv("R_VERSION", "test"), v$topic, v$var), + ".rds" + ) expect_true(file.exists(testVarFile)) if(file.exists(testVarFile)) { testVar <- readRDS(testVarFile) @@ -24,8 +27,8 @@ if(dir.exists("../tmp/ref") & dir.exists("../tmp/test")) { regIgnoreFile <- "../../.regressionignore2" if(file.exists(regIgnoreFile)) { regIgnore <- read.table( - file = regIgnoreFile, - sep = " ", header = FALSE, skip = 5, col.names = c("topic", "var"), + file = regIgnoreFile, + sep = " ", header = FALSE, skip = 5, col.names = c("topic", "var"), stringsAsFactors = FALSE ) } else {