From 076788348758f62161f23b9195c12886711448c3 Mon Sep 17 00:00:00 2001 From: Andrea Manica Date: Wed, 19 Jun 2024 12:31:10 +0100 Subject: [PATCH] skip vrt tests on cran --- R/get_data_path.R | 3 ++- tests/testthat/test_pastclim_rast.R | 2 ++ tests/testthat/test_vrt_set_get_meta.R | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/R/get_data_path.R b/R/get_data_path.R index db2aa2e0..0b2a251c 100644 --- a/R/get_data_path.R +++ b/R/get_data_path.R @@ -37,10 +37,11 @@ get_data_path <- function(silent = FALSE) { "pastclim_data.txt" ))[1, 1] if (!dir.exists(path_to_nc)) { - stop( + warning( "The path ", path_to_nc, " from the config file does not exist!\n", "You can reset the path with `set_data_path`." ) + return(NULL) } return(path_to_nc) } diff --git a/tests/testthat/test_pastclim_rast.R b/tests/testthat/test_pastclim_rast.R index ef5d4da1..2b6bf8a5 100644 --- a/tests/testthat/test_pastclim_rast.R +++ b/tests/testthat/test_pastclim_rast.R @@ -1,6 +1,8 @@ # this file tests the setting and getting of metadata from a vrt file # we work in the temp directory +skip_on_cran() +# the gdal utilities are not properly installed on CRANs linux server test_that("pastclim_rast handles vrt correctly", { vrt_path <- file.path(tempdir(),"test.vrt") tif_files <- list.files(system.file("extdata/CHELSA_bio01", package="pastclim"), diff --git a/tests/testthat/test_vrt_set_get_meta.R b/tests/testthat/test_vrt_set_get_meta.R index f9083c58..9f1ecb07 100644 --- a/tests/testthat/test_vrt_set_get_meta.R +++ b/tests/testthat/test_vrt_set_get_meta.R @@ -1,5 +1,7 @@ # this file tests the setting and getting of metadata from a vrt file # we work in the temp directory +skip_on_cran() +# buildvrt from gdal is not properly installed on the linux machine on CRAN test_that("setting and getting vrt meta", { vrt_path <- file.path(tempdir(),"test.vrt") tif_files <- list.files(system.file("extdata/CHELSA_bio01", package="pastclim"),