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

paleolimbot pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-nanoarrow.git


The following commit(s) were added to refs/heads/main by this push:
     new 95cf4dcd fix(r): Fix tests for platforms where arrow dataset and/or 
zip is not available (#415)
95cf4dcd is described below

commit 95cf4dcddf65038cc332cb9ac3f0de6e25a52208
Author: Dewey Dunnington <[email protected]>
AuthorDate: Wed Apr 3 13:49:35 2024 -0300

    fix(r): Fix tests for platforms where arrow dataset and/or zip is not 
available (#415)
    
    The `utils::zip()` function is not all that reliable; however, we only
    use it to create test data anyway. This was causing release verification
    to fail on alpine.
    
    While running the tests, I also noticed that one of the IPC skips that
    checks for Arrow dataset does so incorrectly.
---
 r/tests/testthat/test-ipc.R       | 12 +++++++++---
 r/tests/testthat/test-pkg-arrow.R |  6 +++---
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/r/tests/testthat/test-ipc.R b/r/tests/testthat/test-ipc.R
index 5c95f4dc..85adf0f0 100644
--- a/r/tests/testthat/test-ipc.R
+++ b/r/tests/testthat/test-ipc.R
@@ -131,7 +131,10 @@ test_that("read_nanoarrow() works for compressed .zip file 
paths", {
     wd <- getwd()
     on.exit(setwd(wd))
     setwd(tdir)
-    zip(tf, "file.arrows", extras = "-q")
+    tryCatch(
+      zip(tf, "file.arrows", extras = "-q"),
+      error = function(...) skip("zip() not supported")
+    )
   })
 
   stream <- read_nanoarrow(tf)
@@ -166,7 +169,10 @@ test_that("read_nanoarrow() errors zip archives that 
contain files != 1", {
     wd <- getwd()
     on.exit(setwd(wd))
     setwd(tdir)
-    zip(tf, c("file1", "file2"), extras = "-q")
+    tryCatch(
+      zip(tf, c("file1", "file2"), extras = "-q"),
+      error = function(...) skip("zip() not supported")
+    )
   })
 
   expect_error(
@@ -234,7 +240,7 @@ test_that("read_nanoarrow() respects lazy argument", {
 
 test_that("read_nanoarrow() from connection errors when called from another 
thread", {
   skip_if_not_installed("arrow")
-  skip_if_not("dataset" %in% names(arrow::arrow_info()$capabilities))
+  skip_if_not(arrow::arrow_info()$capabilities["dataset"])
   skip_if_not_installed("dplyr")
 
   tf <- tempfile()
diff --git a/r/tests/testthat/test-pkg-arrow.R 
b/r/tests/testthat/test-pkg-arrow.R
index 481a0db7..2587f606 100644
--- a/r/tests/testthat/test-pkg-arrow.R
+++ b/r/tests/testthat/test-pkg-arrow.R
@@ -51,7 +51,7 @@ test_that("infer_nanoarrow_schema() works for arrow objects", 
{
   )
   expect_true(arrow::as_schema(tbl_schema)$Equals(tbl_schema_expected))
 
-  skip_if_not(isTRUE(arrow::arrow_info()$capabilities["dataset"]))
+  skip_if_not(arrow::arrow_info()$capabilities["dataset"])
 
   tbl_schema <- infer_nanoarrow_schema(
     arrow::InMemoryDataset$create(arrow::record_batch(x = 1L))
@@ -382,7 +382,7 @@ test_that("Table to nanoarrow_array_stream works", {
 
 test_that("Dataset to nanoarrow_array_stream works", {
   skip_if_not_installed("arrow")
-  skip_if_not(isTRUE(arrow::arrow_info()$capabilities["dataset"]))
+  skip_if_not(arrow::arrow_info()$capabilities["dataset"])
 
   dataset <- arrow::InMemoryDataset$create(arrow::arrow_table(a = 1:5, b = 
letters[1:5]))
   stream <- as_nanoarrow_array_stream(dataset)
@@ -397,7 +397,7 @@ test_that("Dataset to nanoarrow_array_stream works", {
 
 test_that("Scanner to nanoarrow_array_stream works", {
   skip_if_not_installed("arrow")
-  skip_if_not(isTRUE(arrow::arrow_info()$capabilities["dataset"]))
+  skip_if_not(arrow::arrow_info()$capabilities["dataset"])
 
   dataset <- arrow::InMemoryDataset$create(arrow::arrow_table(a = 1:5, b = 
letters[1:5]))
   scanner <- arrow::Scanner$create(dataset)

Reply via email to