From e532b43aa6d5466adf4d2e1f591747a1ffa6cfec Mon Sep 17 00:00:00 2001 From: E-O-Conchas Date: Fri, 20 Mar 2026 14:01:21 +0100 Subject: [PATCH 1/3] make artificial upload non-blocking in CI --- .github/workflows/R.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/R.yaml b/.github/workflows/R.yaml index 5e1fb42..4f0665e 100644 --- a/.github/workflows/R.yaml +++ b/.github/workflows/R.yaml @@ -68,7 +68,9 @@ jobs: - name: Upload test results if: failure() + continue-on-error: true uses: actions/upload-artifact@v5 with: name: coverage-test-failures path: ${{ runner.temp }}/package + if-no-files-found: ignore From 81bca4dc7404e0791c5cd79ac0a4b48d2de0b4e2 Mon Sep 17 00:00:00 2001 From: E-O-Conchas Date: Fri, 20 Mar 2026 16:33:32 +0100 Subject: [PATCH 2/3] Stabilize portal download tests in CI --- tests/testthat/test-download.R | 101 +++++++++++++++++---------------- 1 file changed, 52 insertions(+), 49 deletions(-) diff --git a/tests/testthat/test-download.R b/tests/testthat/test-download.R index 0c6b5d0..13e6d13 100644 --- a/tests/testthat/test-download.R +++ b/tests/testthat/test-download.R @@ -1,54 +1,57 @@ # basic tests for ebv_download ---- -#check url -portal_down <- ebv_i_check_url('https://portal.geobon.org/api/v1/datasets') - -if(portal_down){ - #expect an error - expect_error(ebv_download(27, dir, verbose = FALSE)) - }else{ - #run 'normal' tests - test_that("test ebv_download ID=numeric", { - dir <- tempdir() - data <- ebv_download(27, dir, verbose = FALSE) - expect_true(basename(data) %in% list.files(dir)) - #clean - unlink(dir, recursive=TRUE) - }) - - test_that("test ebv_download ID=doi", { - dir <- tempdir() - data <- ebv_download('10.25829/f2rdp4', dir, verbose = FALSE) - expect_true(basename(data) %in% list.files(dir)) - #clean - unlink(dir, recursive=TRUE) - }) - - test_that("test ebv_download ID=title 1", { - dir <- tempdir() - data <- ebv_download('Local bird diversity (cSAR/BES-SIM)', dir, verbose = FALSE) - expect_true(basename(data) %in% list.files(dir)) - #clean - unlink(dir, recursive=TRUE) - }) - - test_that("test ebv_download ID=title 2", { - dir <- tempdir() - data <- ebv_download("Global trends in biodiversity (BES-SIM PREDICTS)", dir, verbose = FALSE) - expect_true(basename(data) %in% list.files(dir)) - #clean - unlink(dir, recursive=TRUE) - }) - - test_that("test ebv_download DOIs in download overview table", { - data <- ebv_download(verbose=FALSE) - #check col names - expect_equal(names(data), c("id","title","doi")) - #check a view DOIs - expect_equal(data[data$id==7, 'doi'], '10.25829/f2rdp4') - expect_equal(data[data$id==42, 'doi'], '10.25829/tder31') - expect_equal(data[data$id==28, 'doi'], '10.25829/bk5g87') - }) +skip_if_portal_tests_unavailable <- function() { + testthat::skip_on_ci() + testthat::skip_if_offline() + if (ebv_i_check_url("https://portal.geobon.org/api/v1/datasets")) { + testthat::skip("EBV Data Portal API is not reachable") + } } +test_that("test ebv_download ID=numeric", { + skip_if_portal_tests_unavailable() + + dir <- tempdir() + data <- ebv_download(27, dir, verbose = FALSE) + expect_true(basename(data) %in% list.files(dir)) + unlink(dir, recursive = TRUE) +}) + +test_that("test ebv_download ID=doi", { + skip_if_portal_tests_unavailable() + + dir <- tempdir() + data <- ebv_download("10.25829/f2rdp4", dir, verbose = FALSE) + expect_true(basename(data) %in% list.files(dir)) + unlink(dir, recursive = TRUE) +}) + +test_that("test ebv_download ID=title 1", { + skip_if_portal_tests_unavailable() + + dir <- tempdir() + data <- ebv_download("Local bird diversity (cSAR/BES-SIM)", dir, verbose = FALSE) + expect_true(basename(data) %in% list.files(dir)) + unlink(dir, recursive = TRUE) +}) + +test_that("test ebv_download ID=title 2", { + skip_if_portal_tests_unavailable() + + dir <- tempdir() + data <- ebv_download("Global trends in biodiversity (BES-SIM PREDICTS)", dir, verbose = FALSE) + expect_true(basename(data) %in% list.files(dir)) + unlink(dir, recursive = TRUE) +}) + +test_that("test ebv_download DOIs in download overview table", { + skip_if_portal_tests_unavailable() + + data <- ebv_download(verbose = FALSE) + expect_equal(names(data), c("id", "title", "doi")) + expect_equal(data[data$id == 7, "doi"], "10.25829/f2rdp4") + expect_equal(data[data$id == 42, "doi"], "10.25829/tder31") + expect_equal(data[data$id == 28, "doi"], "10.25829/bk5g87") +}) + From fd676669ebe48ce48f45f4cd908c8890521342a7 Mon Sep 17 00:00:00 2001 From: E-O-Conchas Date: Fri, 20 Mar 2026 17:06:32 +0100 Subject: [PATCH 3/3] Avoid live portal download in ebv_download example --- R/ebv_download.R | 8 ++++---- man/ebv_download.Rd | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/R/ebv_download.R b/R/ebv_download.R index cf9ad57..e3f489d 100644 --- a/R/ebv_download.R +++ b/R/ebv_download.R @@ -27,13 +27,13 @@ #' #' @examples #' -#' \donttest{ -#' #' #get all available datasets +#' \dontrun{ +#' # get all available datasets #' datasets <- ebv_download() #' #' ebv_download(id = datasets$id[1], outputdir = -#' tempdir(), overwrite=TRUE, -#' verbose=FALSE) +#' tempdir(), overwrite = TRUE, +#' verbose = FALSE) #' } ebv_download <- function(id=NULL, outputdir, diff --git a/man/ebv_download.Rd b/man/ebv_download.Rd index fb77258..904be9b 100644 --- a/man/ebv_download.Rd +++ b/man/ebv_download.Rd @@ -38,12 +38,12 @@ output directory. } \examples{ -\donttest{ -#' #get all available datasets +\dontrun{ +# get all available datasets datasets <- ebv_download() ebv_download(id = datasets$id[1], outputdir = -tempdir(), overwrite=TRUE, -verbose=FALSE) + tempdir(), overwrite = TRUE, + verbose = FALSE) } }