diff --git a/r/tests/testthat/helper-skip.R b/r/tests/testthat/helper-skip.R index 24e5b3f7dc5..fd1ce1a76c3 100644 --- a/r/tests/testthat/helper-skip.R +++ b/r/tests/testthat/helper-skip.R @@ -92,12 +92,12 @@ skip_on_linux_devel <- function() { } } -skip_if_r_version <- function(r_version) { +skip_on_r_older_than <- function(r_version) { if (force_tests()) { return() } - if (getRversion() <= r_version) { + if (getRversion() < r_version) { skip(paste("R version:", getRversion())) } } diff --git a/r/tests/testthat/test-Array.R b/r/tests/testthat/test-Array.R index ebc60850951..56c7028d6a6 100644 --- a/r/tests/testthat/test-Array.R +++ b/r/tests/testthat/test-Array.R @@ -785,7 +785,7 @@ test_that("Handling string data with embedded nuls", { # The behavior of the warnings/errors is slightly different with and without # altrep. Without it (i.e. 3.5.0 and below, the error would trigger immediately # on `as.vector()` where as with it, the error only happens on materialization) - skip_if_r_version("3.5.0") + skip_on_r_older_than("3.6") # no error on conversion, because altrep laziness v <- expect_error(as.vector(array_with_nul), NA) diff --git a/r/tests/testthat/test-RecordBatch.R b/r/tests/testthat/test-RecordBatch.R index a39aa0f0fb9..e7602d9f744 100644 --- a/r/tests/testthat/test-RecordBatch.R +++ b/r/tests/testthat/test-RecordBatch.R @@ -626,7 +626,7 @@ test_that("Handling string data with embedded nuls", { # The behavior of the warnings/errors is slightly different with and without # altrep. Without it (i.e. 3.5.0 and below, the error would trigger immediately # on `as.vector()` where as with it, the error only happens on materialization) - skip_if_r_version("3.5.0") + skip_on_r_older_than("3.6") df <- as.data.frame(batch_with_nul) expect_error( diff --git a/r/tests/testthat/test-altrep.R b/r/tests/testthat/test-altrep.R index 082a3ea91fe..cd1d841c420 100644 --- a/r/tests/testthat/test-altrep.R +++ b/r/tests/testthat/test-altrep.R @@ -15,7 +15,7 @@ # specific language governing permissions and limitations # under the License. -skip_if_r_version("3.5.0") +skip_on_r_older_than("3.6") test_that("is_arrow_altrep() does not include base altrep", { expect_false(is_arrow_altrep(1:10)) diff --git a/r/tests/testthat/test-chunked-array.R b/r/tests/testthat/test-chunked-array.R index 5f32184efc0..ce43d84274f 100644 --- a/r/tests/testthat/test-chunked-array.R +++ b/r/tests/testthat/test-chunked-array.R @@ -478,7 +478,7 @@ test_that("Handling string data with embedded nuls", { # The behavior of the warnings/errors is slightly different with and without # altrep. Without it (i.e. 3.5.0 and below, the error would trigger immediately # on `as.vector()` where as with it, the error only happens on materialization) - skip_if_r_version("3.5.0") + skip_on_r_older_than("3.6") v <- expect_error(as.vector(chunked_array_with_nul), NA) diff --git a/r/tests/testthat/test-csv.R b/r/tests/testthat/test-csv.R index 8e463d3abec..fca717cc051 100644 --- a/r/tests/testthat/test-csv.R +++ b/r/tests/testthat/test-csv.R @@ -295,7 +295,7 @@ test_that("more informative error when reading a CSV with headers and schema", { test_that("read_csv_arrow() and write_csv_arrow() accept connection objects", { # connections with csv need RunWithCapturedR, which is not available # in R <= 3.4.4 - skip_if_r_version("3.4.4") + skip_on_r_older_than("3.5") tf <- tempfile() on.exit(unlink(tf)) diff --git a/r/tests/testthat/test-dplyr-funcs-datetime.R b/r/tests/testthat/test-dplyr-funcs-datetime.R index ca70de41d04..ce804d1727f 100644 --- a/r/tests/testthat/test-dplyr-funcs-datetime.R +++ b/r/tests/testthat/test-dplyr-funcs-datetime.R @@ -17,7 +17,7 @@ skip_if(on_old_windows()) # In 3.4 the lack of tzone attribute causes spurious failures -skip_if_r_version("3.4.4") +skip_on_r_older_than("3.5") library(lubridate, warn.conflicts = FALSE) library(dplyr, warn.conflicts = FALSE) diff --git a/r/tests/testthat/test-dplyr-funcs-type.R b/r/tests/testthat/test-dplyr-funcs-type.R index 7ee0ec4d0f8..b32fe8f7f88 100644 --- a/r/tests/testthat/test-dplyr-funcs-type.R +++ b/r/tests/testthat/test-dplyr-funcs-type.R @@ -811,7 +811,7 @@ test_that("format date/time", { withr::local_locale(LC_TIME = "C") } # In 3.4 the lack of tzone attribute causes spurious failures - skip_if_r_version("3.4.4") + skip_on_r_older_than("3.5") times <- tibble( datetime = c(lubridate::ymd_hms("2018-10-07 19:04:05", tz = "Pacific/Marquesas"), NA), diff --git a/r/tests/testthat/test-dplyr-glimpse.R b/r/tests/testthat/test-dplyr-glimpse.R index d39fef9e82c..9deb9087b17 100644 --- a/r/tests/testthat/test-dplyr-glimpse.R +++ b/r/tests/testthat/test-dplyr-glimpse.R @@ -15,6 +15,11 @@ # specific language governing permissions and limitations # under the License. +# The glimpse output for tests with `example_data` is different on R < 3.6 +# because the `lgl` column is generated with `sample()` and the RNG +# algorithm is different in older R versions. +skip_on_r_older_than("3.6") + library(dplyr, warn.conflicts = FALSE) test_that("glimpse() Table/ChunkedArray", { diff --git a/r/tests/testthat/test-dplyr-query.R b/r/tests/testthat/test-dplyr-query.R index 62633eb1d63..d988d1d7529 100644 --- a/r/tests/testthat/test-dplyr-query.R +++ b/r/tests/testthat/test-dplyr-query.R @@ -295,6 +295,7 @@ test_that("No duplicate field names are allowed in an arrow_dplyr_query", { }) test_that("all_sources() finds all data sources in a query", { + skip_if_not_available("dataset") tab <- Table$create(a = 1) ds <- InMemoryDataset$create(tab) expect_equal(all_sources(tab), list(tab)) @@ -333,6 +334,7 @@ test_that("all_sources() finds all data sources in a query", { }) test_that("query_on_dataset() looks at all data sources in a query", { + skip_if_not_available("dataset") tab <- Table$create(a = 1) ds <- InMemoryDataset$create(tab) expect_false(query_on_dataset(tab)) @@ -368,6 +370,7 @@ test_that("query_on_dataset() looks at all data sources in a query", { }) test_that("query_can_stream()", { + skip_if_not_available("dataset") tab <- Table$create(a = 1) ds <- InMemoryDataset$create(tab) expect_true(query_can_stream(tab)) diff --git a/r/tests/testthat/test-feather.R b/r/tests/testthat/test-feather.R index ed02c2c7dee..bed097762a2 100644 --- a/r/tests/testthat/test-feather.R +++ b/r/tests/testthat/test-feather.R @@ -183,7 +183,7 @@ test_that("read_feather() and write_feather() accept connection objects", { skip_if(on_old_windows()) # connections with feather need RunWithCapturedR, which is not available # in R <= 3.4.4 - skip_if_r_version("3.4.4") + skip_on_r_older_than("3.5") tf <- tempfile() on.exit(unlink(tf)) diff --git a/r/tests/testthat/test-safe-call-into-r.R b/r/tests/testthat/test-safe-call-into-r.R index ab69c339c5c..a8027ac4237 100644 --- a/r/tests/testthat/test-safe-call-into-r.R +++ b/r/tests/testthat/test-safe-call-into-r.R @@ -32,7 +32,7 @@ test_that("SafeCallIntoR works from the main R thread", { }) test_that("SafeCallIntoR works within RunWithCapturedR", { - skip_if_r_version("3.4.4") + skip_on_r_older_than("3.5") skip_on_cran() expect_identical( @@ -47,7 +47,7 @@ test_that("SafeCallIntoR works within RunWithCapturedR", { }) test_that("SafeCallIntoR errors from the non-R thread", { - skip_if_r_version("3.4.4") + skip_on_r_older_than("3.5") skip_on_cran() expect_error( diff --git a/r/tests/testthat/test-scalar.R b/r/tests/testthat/test-scalar.R index 3afccf743e3..c2271c866ef 100644 --- a/r/tests/testthat/test-scalar.R +++ b/r/tests/testthat/test-scalar.R @@ -88,7 +88,7 @@ test_that("Handling string data with embedded nuls", { # The behavior of the warnings/errors is slightly different with and without # altrep. Without it (i.e. 3.5.0 and below, the error would trigger immediately # on `as.vector()` where as with it, the error only happens on materialization) - skip_if_r_version("3.5.0") + skip_on_r_older_than("3.6") v <- expect_error(as.vector(scalar_with_nul), NA) expect_error( v[1],