Skip to content

Commit

Permalink
[tests] skip online checks (#1127)
Browse files Browse the repository at this point in the history
  • Loading branch information
JanMarvin committed Sep 1, 2024
1 parent fc5c6be commit d507098
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
7 changes: 7 additions & 0 deletions tests/testthat/helper.R
Original file line number Diff line number Diff line change
Expand Up @@ -1043,3 +1043,10 @@ testsetup <- function() {
}

}

# testthat::skip_if_offline requires curl, but fails if curl is not available
skip_online_checks <- function() {
testthat::skip_on_cran()
testthat::skip_if_not_installed("curl")
testthat::skip_if_offline()
}
8 changes: 4 additions & 4 deletions tests/testthat/test-read_sources.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
test_that("read_xlsx from different sources", {

skip_if_offline()
skip_online_checks()

## URL
xlsxFile <- "https://github.com/JanMarvin/openxlsx2/raw/main/inst/extdata/oxlsx2_sheet.xlsx"
Expand All @@ -26,7 +26,7 @@ test_that("read_xlsx from different sources", {

test_that("wb_load from different sources", {

skip_if_offline()
skip_online_checks()

## URL
xlsxFile <- "https://github.com/JanMarvin/openxlsx2/raw/main/inst/extdata/oxlsx2_sheet.xlsx"
Expand Down Expand Up @@ -194,7 +194,7 @@ test_that("reading charts", {

test_that("load file with xml namespace", {

skip_if_offline()
skip_online_checks()

fl <- "https://github.com/ycphs/openxlsx/files/8480120/2022-04-12-11-42-36-DP_Melanges1.xlsx"

Expand Down Expand Up @@ -305,7 +305,7 @@ test_that("reading of formControl works", {

test_that("reading xml escapes works", {

skip_if_offline()
skip_online_checks()

fl <- "https://github.com/ycphs/openxlsx/files/10032200/sample_data.xlsx"
wb <- wb_load(fl)
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-read_xlsb.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
test_that("reading xlsb works", {

skip_if_offline()
skip_online_checks()

xlsxFile <- testfile_path("openxlsx2_example.xlsb")

Expand All @@ -21,7 +21,7 @@ test_that("reading xlsb works", {

test_that("reading complex xlsb works", {

skip_if_offline()
skip_online_checks()

xlsxFile <- testfile_path("hyperlink.xlsb")

Expand Down Expand Up @@ -65,7 +65,7 @@ test_that("reading complex xlsb works", {

test_that("worksheets with real world formulas", {

skip_if_offline()
skip_online_checks()

xlsxFile <- testfile_path("nhs-core-standards-for-eprr-v6.1.xlsb")

Expand Down

0 comments on commit d507098

Please sign in to comment.