Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file removed inst/etc/XML.r.out.gdal.rds
Binary file not shown.
Binary file removed inst/etc/res_r.water.outlet.rds
Binary file not shown.
311 changes: 0 additions & 311 deletions inst/pre_git_ChangeLog

This file was deleted.

45 changes: 24 additions & 21 deletions tests/testthat/helper.R
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-execGRASS.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-gmeta.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Loading