diff --git a/inst/etc/XML.r.out.gdal.rds b/inst/etc/XML.r.out.gdal.rds deleted file mode 100644 index b10d5d8a6..000000000 Binary files a/inst/etc/XML.r.out.gdal.rds and /dev/null differ diff --git a/inst/etc/res_r.water.outlet.rds b/inst/etc/res_r.water.outlet.rds deleted file mode 100644 index b550856f3..000000000 Binary files a/inst/etc/res_r.water.outlet.rds and /dev/null differ diff --git a/inst/pre_git_ChangeLog b/inst/pre_git_ChangeLog deleted file mode 100644 index 31ccda049..000000000 --- a/inst/pre_git_ChangeLog +++ /dev/null @@ -1,311 +0,0 @@ -2018-11-23 08:42 rsbivand - - * DESCRIPTION, R/initGRASS.R, man/initGRASS.Rd: test gisBase for - bin and scripts - -2018-09-28 07:42 rsbivand - - * ChangeLog, inst/ChangeLog: tidy - -2018-09-24 08:40 rsbivand - - * ChangeLog, inst/ChangeLog: trial updates for OSGEO4W - -2018-09-24 08:39 rsbivand - - * DESCRIPTION, R/initGRASS.R, man/rgrass.Rd: trial updates for - OSGEO4W - -2017-10-20 19:02 rsbivand - - * DESCRIPTION, R/vect_link.R: fix SQLite writeVECT issue - -2017-10-12 10:37 rsbivand - - * DESCRIPTION, R/vect_link.R: OGR drivers Markus Metz fix - -2017-10-11 11:21 rsbivand - - * DESCRIPTION, R/vect_link.R: readVECT driver 7.3 bug resolved - -2016-11-18 14:18 rsbivand - - * DESCRIPTION, R/xml1.R: tidy - -2016-05-09 14:39 rsbivand - - * ChangeLog, inst/ChangeLog: tidy - -2016-05-09 14:38 rsbivand - - * DESCRIPTION: tidy - -2016-04-25 08:07 rsbivand - - * DESCRIPTION, NAMESPACE, R/AAA.R, R/initGRASS.R, R/vect_link.R, - man/initGRASS.Rd: tidy - -2016-04-11 12:13 rsbivand - - * ChangeLog, inst/ChangeLog: tidy - -2016-04-11 12:12 rsbivand - - * DESCRIPTION, R/xml1.R: WinNat *.bat issue - -2016-01-13 11:52 rsbivand - - * R/initGRASS.R, man/initGRASS.Rd: addon in initGRASS - -2016-01-13 08:47 rsbivand - - * DESCRIPTION: fix addons in initGRASS - -2016-01-12 19:17 rsbivand - - * ChangeLog, inst/ChangeLog: tidy - -2016-01-12 19:10 rsbivand - - * R/vect_link.R: fix Windows file transfer issue - -2016-01-12 14:09 rsbivand - - * R/xml1.R: addon bat files fix - -2016-01-11 14:07 rsbivand - - * ChangeLog, R/vect_link.R: vector layer tidy - -2016-01-11 13:51 rsbivand - - * DESCRIPTION, R/AAA.R, R/rgrass.R, R/xml1.R: attempt to make - addons visible under Windows - -2015-10-11 18:38 rsbivand - - * R/vect_link.R: Windows rgdal drivers issue - -2015-10-11 18:32 rsbivand - - * R/vect_link.R: Windows rgdal drivers issue - -2015-10-11 13:48 rsbivand - - * R/vect_link.R: Windows rgdal drivers issue - -2015-10-08 21:27 rsbivand - - * DESCRIPTION, R/vect_link.R: Windows rgdal drivers issue - -2015-09-25 09:02 rsbivand - - * NAMESPACE: importFrom(methods, slot, 'slot<-', as) - -2015-08-23 18:39 rsbivand - - * inst, inst/ChangeLog: tidy - -2015-08-23 18:38 rsbivand - - * ChangeLog: tidy - -2015-08-23 18:36 rsbivand - - * DESCRIPTION, NAMESPACE, R/bin_link.R, R/vect_link.R, - man/readVECT.Rd: adding long field names for vectors - -2015-08-17 19:03 rsbivand - - * DESCRIPTION, R/vect_link.R, man/readVECT.Rd: fix to vect2neigh - -2015-06-28 20:56 rsbivand - - * DESCRIPTION, NAMESPACE: CRAN - _R_CHECK_CODE_USAGE_WITH_ONLY_BASE_ATTACHED_=true NAMESPACE tidy - -2015-06-18 16:31 rkrug - - * R/bin_link.R, R/vect_link.R: Fixed missing mapset in - .read_vect_plugin and .read_rast_plugin - - Thanks to Ahmadou H. DICKO - -2015-06-18 10:28 neteler - - * ChangeLog, DESCRIPTION, R/vect_link.R: rgrass7: R/vect_link.R: - fix for drivers other that ESRI Shapefile - -2015-05-20 18:20 rsbivand - - * R/xml1.R: check all integer matches - -2015-03-10 20:14 rsbivand - - * ChangeLog: tidy - -2015-03-10 20:10 rsbivand - - * DESCRIPTION, inst: tidy - -2015-03-10 20:02 rsbivand - - * man/readRAST.Rd: examples migrated to nc_basic - -2015-03-10 19:50 rsbivand - - * man/execGRASS.Rd, man/gmeta.Rd, man/readRAST.Rd, man/readVECT.Rd, - man/rgrass.Rd: examples migrated to nc_basic - -2015-03-10 18:54 rsbivand - - * DESCRIPTION: tidy - -2015-03-10 14:21 rsbivand - - * R/bin_link.R, man/execGRASS.Rd, man/initGRASS.Rd, - man/readRAST.Rd, man/readVECT.Rd, man/rgrass.Rd: examples - migrated to nc_basic - -2015-02-19 20:16 rsbivand - - * ., DESCRIPTION, R/rgrass.R, R/spgrass.R, man/rgrass.Rd, - man/spgrass.Rd: change name to rgrass7 - -2015-01-31 13:36 rsbivand - - * tidy - -2015-01-29 18:18 rsbivand - - * tidy - -2015-01-29 13:21 rkrug - - * Introduced several tryCatch() to delete files after error - - * based on - http://permalink.gmane.org/gmane.comp.gis.grass.stats/26 - similar potential problems were identified and code encapsulated - in - tryCatch blocks. - -2015-01-29 12:43 rkrug - - * Fixed Bug - http://permalink.gmane.org/gmane.comp.gis.grass.stats/26 - - * temporary files were not deleted upon error. - Wrapped tryCatch block around code. - -2015-01-28 14:16 rkrug - - * Added blocing for spgrass6 and spgrass7 unless correct GRASS GIS - version used - - * spgrass6, spgrass: added two internal functions: - .grassVersion(): returns GRASS GIS version used - .compatibleGRASSVersion(gv=.grassVersion()): returns TRUE if - GRASS GIS version - is compatible, FALSE if not. As an attribute, it returns an error - / status - message which can be printed. - - * spgrass6/AAA.R, spgrass7/AAA.R: added check for - .compatibleGRASSVersion() in .onAttach() - which raises error if GRASS GIS version is not compatible. The - result is that the - package can not be loaded in R when running in an incompatible - GRASS GIS version. - - * spgrass6/initGRASS.R, spgrass7/initGRASS.R: added check for - .compatibleGRASSVersion() - which raises error if GRASS GIS version is not compatible and - aborts initGRASS(). - -2015-01-27 13:05 rsbivand - - * update man pages arguments to match code (running R CMD check) - -2015-01-27 12:21 rsbivand - - * change name from spgrass to spgrass7 - -2015-01-27 11:30 rkrug - - * Refactorng of code from readVect and writeVect - - * introduced internal functions .read_vect_plugin and - .read_vect_non_plugin for actual reading and writing of vector - * moved reading of options from code into default values - (ignore.stderr, plugin, useGDAL) - * wrapped code in tryCatch to reset echoCmdOption - -2015-01-27 11:07 rkrug - - * Summary: Fixed renaming error and added . to internal functions - - * fixed renamin=g error of read_rast_... functions - * added . to function names read_rast_plugin and - .read_rast_non_plugin - -2015-01-27 10:36 rkrug - - * Summary: Rename internal functions to implement - - * renamed - read_plugin -->> read_rast_plugin - read_bin -->> read_rast_nonplugin - To have consistent naming scheme for reading vectors - -2015-01-27 10:26 rkrug - - * Streamlining of code - - * readRAST, writeRAST: changed default values in function - definitions - of ignore.stderr, plugin and useGDAL from NULL to the values - obtained by get....Option() - - * Moved closeAllConnections code outsude the try block to ensure - that opened connections are closed - -2015-01-27 10:00 rkrug - - * Summary: Setting of echoCmdOption fixed - - * readRAST: the resetting of echoCmdOption was only done if - return_SGDF was TRUE. Moved resetting to end of function call and - wrapped into tryCatch() block to reset echoCmdOOption even in - case of error. - - * writeRAST: Wrapped into tryCatch() block to reset - echoCmdOOption even in case of error. - -2015-01-26 14:58 rkrug - - * Summary: Move reading of raster non-plugin into extra function - - * created new internal function read_bin() which reads the - raster, equivalent to read_plugin() - -2015-01-26 13:32 rkrug - - * Spring cleaning for GRASS GIS 7 - - * remove references and code opnly used for grass 6 - * removed check for grass 7 - * changed name of .grassrc6 to .grassrc7 - -2015-01-20 11:50 neteler - - * manual update to G7 - -2015-01-18 20:04 rsbivand - - * adapt to G7 - -2015-01-15 18:12 rsbivand - - * adding development spgrass for 7 and future - diff --git a/tests/testthat/helper.R b/tests/testthat/helper.R index 372ce2245..16c08ae8f 100644 --- a/tests/testthat/helper.R +++ b/tests/testthat/helper.R @@ -1,29 +1,32 @@ download_nc_basic <- function() { + # online source + file_url <- "nc_basic_spm_grass7.zip" + base_url <- "https://grass.osgeo.org/sampledata" + path_url <- "north_carolina" + url <- paste(base_url, path_url, file_url, sep = "/") + + # local file path for download tmpdir <- tempdir() + zip_path <- file.path(tmpdir, file_url) - if (!file.exists(file.path(tmpdir, "nc_basic_spm_grass7.zip"))) { - base_url <- "https://grass.osgeo.org/sampledata" - path_url <- "north_carolina" - file_url <- "nc_basic_spm_grass7.zip" - - download.file( - paste(base_url, path_url, file_url, sep = "/"), - file.path(tmpdir, "nc_basic_spm_grass7.zip") - ) - - unzip( - file.path(tmpdir, "nc_basic_spm_grass7.zip"), - exdir = file.path(tmpdir, "grassdb") - ) - unlink(file.path(tmpdir, "nc_basic_spm_grass7.zip")) - } + # extraction directory + db_dir <- file.path(tmpdir, "grassdb") + + if (!file.exists(zip_path)) { + result <- try({ + suppressWarnings(download.file(url, zip_path, quiet = TRUE)) + }, silent = TRUE) - dataset <- list( - gisDbase = file.path(tmpdir, "grassdb"), - location = "nc_basic_spm_grass7" - ) + if (inherits(result, "try-error")) { + message("Failed to download GRASS GIS example dataset") + return(NULL) + } + + unzip(zip_path, exdir = db_dir) + unlink(zip_path) + } - return(dataset) + return(list(gisDbase = db_dir, location = "nc_basic_spm_grass7")) } get_gisbase <- function() { diff --git a/tests/testthat/test-execGRASS.R b/tests/testthat/test-execGRASS.R index da7744280..25f395a31 100644 --- a/tests/testthat/test-execGRASS.R +++ b/tests/testthat/test-execGRASS.R @@ -3,6 +3,7 @@ library(terra) test_that("testing basic doGRASS, execGRASS, stringexecGRASS", { skip_if_not(!is.null(gisBase), "GRASS GIS not found on PATH") + skip_if(is.null(testdata), "GRASS GIS example dataset is not available") loc <- initGRASS( home = tempdir(), @@ -88,6 +89,7 @@ test_that("testing basic doGRASS, execGRASS, stringexecGRASS", { test_that("testing options doGRASS, execGRASS, stringexecGRASS", { skip_if_not(!is.null(gisBase), "GRASS GIS not found on PATH") + skip_if(is.null(testdata), "GRASS GIS example dataset is not available") loc <- initGRASS( home = tempdir(), diff --git a/tests/testthat/test-gmeta.R b/tests/testthat/test-gmeta.R index 7de9da5fb..9cabc59be 100644 --- a/tests/testthat/test-gmeta.R +++ b/tests/testthat/test-gmeta.R @@ -3,6 +3,7 @@ library(terra) testthat::test_that("testing gmeta", { skip_if_not(!is.null(gisBase), "GRASS GIS not found on PATH") + skip_if(is.null(testdata), "GRASS GIS example dataset is not available") # Initialize a temporary GRASS project using the example data loc <- initGRASS( diff --git a/tests/testthat/test-initGRASS.R b/tests/testthat/test-initGRASS.R index 70ea9e60b..50a9cc6ec 100644 --- a/tests/testthat/test-initGRASS.R +++ b/tests/testthat/test-initGRASS.R @@ -3,6 +3,7 @@ library(terra) test_that("testing basic initGRASS", { skip_if_not(!is.null(gisBase), "GRASS GIS not found on PATH") + skip_if(is.null(testdata), "GRASS GIS example dataset is not available") # Initialize a temporary GRASS project using the example data loc <- initGRASS( @@ -30,6 +31,7 @@ test_that("testing initialization from SpatRaster", { test_that("testing remove_GISRC", { skip_if_not(!is.null(gisBase), "GRASS GIS not found on PATH") + skip_if(is.null(testdata), "GRASS GIS example dataset is not available") loc <- initGRASS( home = tempdir(), @@ -52,6 +54,7 @@ test_that("testing remove_GISRC", { test_that("testing set/unset.GIS_LOCK", { skip_if_not(!is.null(gisBase), "GRASS GIS not found on PATH") skip_if_not(Sys.info()["sysname"] == "Linux", "test only works on *nix") + skip_if(is.null(testdata), "GRASS GIS example dataset is not available") loc <- initGRASS( home = tempdir(), diff --git a/tests/testthat/test-options.R b/tests/testthat/test-options.R index 9b269f1f1..6169dde71 100644 --- a/tests/testthat/test-options.R +++ b/tests/testthat/test-options.R @@ -3,6 +3,8 @@ library(terra) test_that("testing ignore.stderrOption", { skip_if_not(!is.null(gisBase), "GRASS GIS not found on PATH") + skip_if(is.null(testdata), "GRASS GIS example dataset is not available") + origIgnoreStderr <- get.ignore.stderrOption() loc <- initGRASS( @@ -36,6 +38,8 @@ test_that("testing ignore.stderrOption", { test_that("testing stop_on_no_flags_parasOption", { skip_if_not(!is.null(gisBase), "GRASS GIS not found on PATH") + skip_if(is.null(testdata), "GRASS GIS example dataset is not available") + origStopOnNoFlagsParas <- get.stop_on_no_flags_parasOption() # testing stop_on_no_flags_parasOption set to TRUE by default @@ -67,6 +71,8 @@ test_that("testing stop_on_no_flags_parasOption", { test_that("testing echoCmdOption option", { skip_if_not(!is.null(gisBase), "GRASS GIS not found on PATH") + skip_if(is.null(testdata), "GRASS GIS example dataset is not available") + origEchoCmd <- get.echoCmdOption() # testing echoCmdOption (set to FALSE by default) @@ -112,6 +118,8 @@ test_that("testing echoCmdOption option", { test_that("testing useInternOption option", { skip_if_not(!is.null(gisBase), "GRASS GIS not found on PATH") + skip_if(is.null(testdata), "GRASS GIS example dataset is not available") + origUseIntern <- get.useInternOption() # testing echoCmdOption (set to FALSE by default) @@ -139,6 +147,8 @@ test_that("testing useInternOption option", { test_that("testing legacyExecOption option", { skip_if_not(!is.null(gisBase), "GRASS GIS not found on PATH") + skip_if(is.null(testdata), "GRASS GIS example dataset is not available") + origLegacyExec <- get.legacyExecOption() # testing echoCmdOption (set to FALSE by default) @@ -180,6 +190,8 @@ test_that("testing legacyExecOption option", { test_that("testing defaultFlagsOption option", { skip_if_not(!is.null(gisBase), "GRASS GIS not found on PATH") + skip_if(is.null(testdata), "GRASS GIS example dataset is not available") + origDefaultFlags <- get.defaultFlagsOption() # testing echoCmdOption (set to FALSE by default) diff --git a/tests/testthat/test-read_RAST.R b/tests/testthat/test-read_RAST.R index 6515b132c..cedcb1cc0 100644 --- a/tests/testthat/test-read_RAST.R +++ b/tests/testthat/test-read_RAST.R @@ -2,7 +2,7 @@ library(testthat) library(terra) library(sp) -if (!is.null(gisBase)) { +if (!is.null(gisBase) & !is.null(testdata)) { loc <- initGRASS( home = tempdir(), gisBase = gisBase, @@ -15,6 +15,7 @@ if (!is.null(gisBase)) { test_that("testing read_RAST using terra", { skip_if_not(!is.null(gisBase), "GRASS GIS not found on PATH") + skip_if(is.null(testdata), "GRASS GIS example dataset is not available") # read a categorical raster map v1 <- read_RAST("landuse", cat = TRUE, return_format = "terra") @@ -33,6 +34,7 @@ test_that("testing read_RAST using terra", { test_that("testing read_RAST using sp", { skip_if_not(!is.null(gisBase), "GRASS GIS not found on PATH") + skip_if(is.null(testdata), "GRASS GIS example dataset is not available") skip_on_ci() skip_on_cran() diff --git a/tests/testthat/test-read_VECT.R b/tests/testthat/test-read_VECT.R index a5bf13810..af13929ea 100644 --- a/tests/testthat/test-read_VECT.R +++ b/tests/testthat/test-read_VECT.R @@ -4,6 +4,7 @@ library(terra) # test basic read_VECT operation test_that("testing read_VECT", { skip_if_not(!is.null(gisBase), "GRASS GIS not found on PATH") + skip_if(is.null(testdata), "GRASS GIS example dataset is not available") if (!is.null(gisBase)) { loc <- initGRASS( @@ -29,6 +30,7 @@ test_that("testing read_VECT", { test_that("testing write_VECT", { skip_if_not(!is.null(gisBase), "GRASS GIS not found on PATH") + skip_if(is.null(testdata), "GRASS GIS example dataset is not available") shp <- vect(system.file("ex/lux.shp", package = "terra")) elev <- rast(system.file("ex/elev.tif", package = "terra")) @@ -49,6 +51,7 @@ test_that("testing write_VECT", { # test basic vect2neigh operation test_that("testing vect2neigh", { skip_if_not(!is.null(gisBase), "GRASS GIS not found on PATH") + skip_if(is.null(testdata), "GRASS GIS example dataset is not available") if (!is.null(gisBase)) { loc <- initGRASS(