From c9c6625edbf48670543584c0b90aad485b6275a8 Mon Sep 17 00:00:00 2001 From: Julien Brun Date: Tue, 6 Aug 2024 10:08:08 -0700 Subject: [PATCH] switch to skip_if_offline() for tests --- tests/testthat/test-check_version.R | 2 +- tests/testthat/test-download_EML_data.R | 2 +- tests/testthat/test-download_ISO_data.R | 2 +- tests/testthat/test-download_d1_data.R | 16 ++++++++-------- tests/testthat/test-download_d1_data_pkg.R | 5 +++-- tests/testthat/test-get_pkg_pids.R | 2 +- tests/testthat/test-read_d1_files.R | 4 ++-- 7 files changed, 17 insertions(+), 16 deletions(-) diff --git a/tests/testthat/test-check_version.R b/tests/testthat/test-check_version.R index bc88c0a..39e89e4 100644 --- a/tests/testthat/test-check_version.R +++ b/tests/testthat/test-check_version.R @@ -10,7 +10,7 @@ test_that("accepts correct inputs", { test_that("warnings or errors are issued", { # Takes too much time and add load on servers - skip_on_cran() + skip_if_offline() # Should correctly identify format type out <- check_version("https://cn.dataone.org/cn/v2/resolve/urn:uuid:a2834e3e-f453-4c2b-8343-99477662b570") diff --git a/tests/testthat/test-download_EML_data.R b/tests/testthat/test-download_EML_data.R index 26024a3..154dbe0 100644 --- a/tests/testthat/test-download_EML_data.R +++ b/tests/testthat/test-download_EML_data.R @@ -3,7 +3,7 @@ context("download_EML_data()") #adding a test for a dataset that uses EML metadata from Arctic Data Center member node test_that("test data URL with eml metadata from the Arctic Data Center member node and with multiple data tables", { # Takes too much time and add load on servers - skip_on_cran() + skip_if_offline() temp_dir <- tempdir() data_id <- "urn:uuid:4b5b35cf-7a39-449f-90f1-93fb3e6fb242" diff --git a/tests/testthat/test-download_ISO_data.R b/tests/testthat/test-download_ISO_data.R index 1a229b5..2644def 100644 --- a/tests/testthat/test-download_ISO_data.R +++ b/tests/testthat/test-download_ISO_data.R @@ -3,7 +3,7 @@ context("download_ISO_data()") #adding a test for a dataset that uses ISO metadata from Research Workspace member node test_that("test data URL with ISO metadata from Research Workspace member node and with multiple data tables", { # Takes too much time and add load on servers - skip_on_cran() + skip_if_offline() temp_dir <- tempdir() data_id <- "8181dc0f-25fe-45c2-9bcd-0af54276aa62" diff --git a/tests/testthat/test-download_d1_data.R b/tests/testthat/test-download_d1_data.R index d98f7a7..a573220 100644 --- a/tests/testthat/test-download_d1_data.R +++ b/tests/testthat/test-download_d1_data.R @@ -12,7 +12,7 @@ test_that("accepts correct inputs", { test_that("test Arctic Data Center data URL (fully up to date data file)", { # Takes too much time and add load on servers - skip_on_cran() + skip_if_offline() temp_dir <- tempdir() out <- download_d1_data(data_url = "https://cn.dataone.org/cn/v2/resolve/urn:uuid:a2834e3e-f453-4c2b-8343-99477662b570", @@ -33,7 +33,7 @@ test_that("test Arctic Data Center data URL (fully up to date data file)", { test_that("test Arctic Data Center data URL (fully up to date data file) with one data table", { # Takes too much time and add load on servers - skip_on_cran() + skip_if_offline() temp_dir <- tempdir() out <- download_d1_data("https://cn.dataone.org/cn/v2/resolve/urn:uuid:a2834e3e-f453-4c2b-8343-99477662b570", @@ -54,7 +54,7 @@ test_that("test Arctic Data Center data URL (fully up to date data file) with on test_that("test Arctic Data Center data URL (fully up to date data file) with multiple data tables", { # Takes too much time and add load on servers - skip_on_cran() + skip_if_offline() temp_dir <- tempdir() out <- download_d1_data(data_url = "https://cn.dataone.org/cn/v2/resolve/urn:uuid:a4f85031-0b91-4d92-ba0a-b02f216bba64", @@ -76,7 +76,7 @@ test_that("test Arctic Data Center data URL (fully up to date data file) with mu test_that("Data without metadata downloads and returns summary metadata", { # Takes too much time and add load on servers - skip_on_cran() + skip_if_offline() temp_dir <- tempdir() expect_error(download_d1_data(data_url = "urn:uuid:7bdab6cc-8dc1-4c49-a80b-ca771c18eaa9", @@ -93,7 +93,7 @@ test_that("Data without metadata downloads and returns summary metadata", { #adding a test for a dataset that uses ISO metadata and is from the Alaska Ocean Observing System member node test_that("test data URL with ISO metadata from AOOS member node and with multiple data tables", { # Takes too much time and add load on servers - skip_on_cran() + skip_if_offline() temp_dir <- tempdir() out <- expect_warning(download_d1_data(data_url = "https://cn.dataone.org/cn/v2/resolve/4139539e-94e7-49cc-9c7a-5f879e438b16", @@ -114,7 +114,7 @@ test_that("test data URL with ISO metadata from AOOS member node and with multip #adding a test for a dataset that uses ISO metadata from Research Workspace member node test_that("test data URL with ISO metadata from Research Workspace member node and with multiple data tables", { # Takes too much time and add load on servers - skip_on_cran() + skip_if_offline() temp_dir <- tempdir() out <- download_d1_data(data_url = "https://cn.dataone.org/cn/v2/resolve/f8e4b479-2c85-4cfd-ad69-4aa059b58a92", @@ -135,7 +135,7 @@ test_that("test data URL with ISO metadata from Research Workspace member node a # EDI data test test_that("test EDI data URL (fully up to date data file) with multiple data tables", { # Takes too much time and add load on servers - skip_on_cran() + skip_if_offline() temp_dir <- tempdir() out <- download_d1_data(data_url = "https://cn.dataone.org/cn/v2/resolve/https%3A%2F%2Fpasta.lternet.edu%2Fpackage%2Fdata%2Feml%2Fedi%2F746%2F1%2F2eac05447c1141bc8942284dfb32643c", @@ -158,7 +158,7 @@ test_that("test EDI data URL (fully up to date data file) with multiple data tab # Another EDI test test_that("test EDI data URL (fully up to date data file, eml v2.2.0) with one data table", { # Takes too much time and add load on servers - skip_on_cran() + skip_if_offline() temp_dir <- tempdir() out <- download_d1_data(data_url = "https://cn.dataone.org/cn/v2/resolve/https%3A%2F%2Fpasta.lternet.edu%2Fpackage%2Fdata%2Feml%2Fedi%2F858%2F1%2F15ad768241d2eeed9f0ba159c2ab8fd5", diff --git a/tests/testthat/test-download_d1_data_pkg.R b/tests/testthat/test-download_d1_data_pkg.R index 49945a2..beba4d3 100644 --- a/tests/testthat/test-download_d1_data_pkg.R +++ b/tests/testthat/test-download_d1_data_pkg.R @@ -13,7 +13,7 @@ test_that("accepts correct inputs", { # EDI package test(s) ---- test_that("accepts EDI data package", { # Takes too much time and add load on servers - skip_on_cran() + skip_if_offline() output <- download_d1_data_pkg( meta_obj = 'doi:10.6073/pasta/9f2f89e48f9e943f7125d1a335d96eb0', @@ -26,7 +26,8 @@ test_that("accepts EDI data package", { # Arctic Data Center test(s) ---- test_that("accepts Arctic Data Center data package", { # Takes too much time and add load on servers - skip_on_cran() + skip_if_offline() + output <- download_d1_data_pkg( meta_obj = 'doi:10.18739/A2B27PS44', path = tempdir() diff --git a/tests/testthat/test-get_pkg_pids.R b/tests/testthat/test-get_pkg_pids.R index d560635..0174fa4 100644 --- a/tests/testthat/test-get_pkg_pids.R +++ b/tests/testthat/test-get_pkg_pids.R @@ -2,7 +2,7 @@ context("get_pkg_pids()") test_that('data package report is not "data"', { # Takes too much time and add load on servers - skip_on_cran() + skip_if_offline() output <- suppressMessages( get_pkg_pids( diff --git a/tests/testthat/test-read_d1_files.R b/tests/testthat/test-read_d1_files.R index cf807a5..a37a164 100644 --- a/tests/testthat/test-read_d1_files.R +++ b/tests/testthat/test-read_d1_files.R @@ -25,7 +25,7 @@ test_that("test read in csv files", { test_that("read Arctic Data Center data package", { # Takes too much time and add load on servers - skip_on_cran() + skip_if_offline() # Call download_di_data_pkg() for data package temp_dir <- tempdir() @@ -47,7 +47,7 @@ test_that("read Arctic Data Center data package", { test_that("read EDI data package", { # Takes too much time and add load on servers - skip_on_cran() + skip_if_offline() # Grab temp directory as an object temp_dir <- tempdir()