This is an automated email from the ASF dual-hosted git repository.

npr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new f295da4cfd MINOR: [R] Conditionally skip some glimpse-related tests 
(#13610)
f295da4cfd is described below

commit f295da4cfdcf102d9ac2d16bbca6f8342fc3e6a8
Author: Neal Richardson <[email protected]>
AuthorDate: Thu Jul 14 19:17:54 2022 -0400

    MINOR: [R] Conditionally skip some glimpse-related tests (#13610)
    
    Authored-by: Neal Richardson <[email protected]>
    Signed-off-by: Neal Richardson <[email protected]>
---
 r/tests/testthat/helper-skip.R               | 4 ++--
 r/tests/testthat/test-Array.R                | 2 +-
 r/tests/testthat/test-RecordBatch.R          | 2 +-
 r/tests/testthat/test-altrep.R               | 2 +-
 r/tests/testthat/test-chunked-array.R        | 2 +-
 r/tests/testthat/test-csv.R                  | 2 +-
 r/tests/testthat/test-dplyr-funcs-datetime.R | 2 +-
 r/tests/testthat/test-dplyr-funcs-type.R     | 2 +-
 r/tests/testthat/test-dplyr-glimpse.R        | 5 +++++
 r/tests/testthat/test-dplyr-query.R          | 3 +++
 r/tests/testthat/test-feather.R              | 2 +-
 r/tests/testthat/test-safe-call-into-r.R     | 4 ++--
 r/tests/testthat/test-scalar.R               | 2 +-
 13 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/r/tests/testthat/helper-skip.R b/r/tests/testthat/helper-skip.R
index 24e5b3f7dc..fd1ce1a76c 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 ebc6085095..56c7028d6a 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 a39aa0f0fb..e7602d9f74 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 082a3ea91f..cd1d841c42 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 5f32184efc..ce43d84274 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 8e463d3abe..fca717cc05 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 ca70de41d0..ce804d1727 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 7ee0ec4d0f..b32fe8f7f8 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 d39fef9e82..9deb9087b1 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 62633eb1d6..d988d1d752 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 ed02c2c7de..bed097762a 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 ab69c339c5..a8027ac423 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 3afccf743e..c2271c866e 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],

Reply via email to