Skip to content

Commit

Permalink
switch to skip_if_offline() for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
brunj7 committed Aug 6, 2024
1 parent dce90b3 commit c9c6625
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion tests/testthat/test-check_version.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-download_EML_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-download_ISO_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
16 changes: 8 additions & 8 deletions tests/testthat/test-download_d1_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down
5 changes: 3 additions & 2 deletions tests/testthat/test-download_d1_data_pkg.R
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-get_pkg_pids.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-read_d1_files.R
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand Down

0 comments on commit c9c6625

Please sign in to comment.