Skip to content

Commit

Permalink
add cleanup procedure for testsuite to add deferred removal of nc_bas…
Browse files Browse the repository at this point in the history
…ic_spm_grass7
  • Loading branch information
stevenpawley committed Feb 6, 2025
1 parent efee284 commit 588639b
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 22 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@ jobs:
sudo apt-get update
sudo apt-get install -y grass-dev libgdal-dev libudunits2-dev libharfbuzz-dev libfribidi-dev
- name: Download test dataset
run: |
wget https://grass.osgeo.org/sampledata/north_carolina/nc_basic_spm_grass7.zip -O /tmp/nc_basic_spm_grass7.zip
unzip /tmp/nc_basic_spm_grass7.zip -d /tmp/grassdb
rm /tmp/nc_basic_spm_grass7.zip
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck, any::terra
Expand Down
10 changes: 0 additions & 10 deletions .github/workflows/check-releasebranch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,6 @@ jobs:
R -e "install.packages(c('remotes', 'rcmdcheck'))"
R -e "remotes::install_deps(dependencies = TRUE)"
R -e "install.packages('terra', repos = 'https://cloud.r-project.org/', type = 'source')"
- name: Download test dataset
run: |
wget https://grass.osgeo.org/sampledata/north_carolina/nc_basic_spm_grass7.zip -O /tmp/nc_basic_spm_grass7.zip
unzip /tmp/nc_basic_spm_grass7.zip -d /tmp/grassdb
rm /tmp/nc_basic_spm_grass7.zip
# - name: Run R CMD check
# run: |
# R -e "rcmdcheck::rcmdcheck(args = c('--no-manual', '--no-build-vignettes'), error_on = 'error', check_dir = 'check')"
- uses: r-lib/actions/check-r-package@v2
with:
Expand Down
4 changes: 3 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ Suggests:
stars,
raster (>= 3.6-3),
codetools,
testthat (>= 3.0.0)
testthat (>= 3.0.0),
withr,
fs
VignetteBuilder: knitr
SystemRequirements: GRASS (>= 7)
License: GPL (>= 2)
Expand Down
6 changes: 1 addition & 5 deletions tests/testthat/helper.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
download_nc_basic <- function() {
if (Sys.info()["sysname"] == "Linux") {
tmpdir <- "/tmp"
} else{
tmpdir <- tempdir()
}
tmpdir <- tempdir()

if (!file.exists(file.path(tmpdir, "nc_basic_spm_grass7.zip"))) {
base_url <- "https://grass.osgeo.org/sampledata"
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 @@ -4,6 +4,8 @@ source("helper.R")

# setup
testdata <- download_nc_basic()
withr::defer(fs::dir_delete(testdata$gisDbase))

gisBase <- get_gisbase()

test_that("testing basic doGRASS, execGRASS, stringexecGRASS", {
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-gmeta.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ source("helper.R")

# setup
testdata <- download_nc_basic()
withr::defer(fs::dir_delete(testdata$gisDbase))

gisBase <- get_gisbase()

testthat::test_that("testing gmeta", {
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-initGRASS.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ source("helper.R")

# setup
testdata <- download_nc_basic()
withr::defer(fs::dir_delete(testdata$gisDbase))

gisBase <- get_gisbase()

test_that("testing basic initGRASS", {
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-options.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ source("helper.R")

# setup
testdata <- download_nc_basic()
withr::defer(fs::dir_delete(testdata$gisDbase))

gisBase <- get_gisbase()

test_that("testing ignore.stderrOption", {
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-read_RAST.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ source("helper.R")

# setup (share grass session across tests)
testdata <- download_nc_basic()
withr::defer(fs::dir_delete(testdata$gisDbase))

gisBase <- get_gisbase()

if (!is.null(gisBase)) {
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-read_VECT.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ source("helper.R")

# setup (share grass session across tests)
testdata <- download_nc_basic()
withr::defer(fs::dir_delete(testdata$gisDbase))

gisBase <- get_gisbase()

# test basic read_VECT operation
Expand Down

0 comments on commit 588639b

Please sign in to comment.