Skip to content

Commit f295da4

Browse files
MINOR: [R] Conditionally skip some glimpse-related tests (apache#13610)
Authored-by: Neal Richardson <neal.p.richardson@gmail.com> Signed-off-by: Neal Richardson <neal.p.richardson@gmail.com>
1 parent cf03901 commit f295da4

13 files changed

Lines changed: 21 additions & 13 deletions

r/tests/testthat/helper-skip.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,12 @@ skip_on_linux_devel <- function() {
9292
}
9393
}
9494

95-
skip_if_r_version <- function(r_version) {
95+
skip_on_r_older_than <- function(r_version) {
9696
if (force_tests()) {
9797
return()
9898
}
9999

100-
if (getRversion() <= r_version) {
100+
if (getRversion() < r_version) {
101101
skip(paste("R version:", getRversion()))
102102
}
103103
}

r/tests/testthat/test-Array.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ test_that("Handling string data with embedded nuls", {
785785
# The behavior of the warnings/errors is slightly different with and without
786786
# altrep. Without it (i.e. 3.5.0 and below, the error would trigger immediately
787787
# on `as.vector()` where as with it, the error only happens on materialization)
788-
skip_if_r_version("3.5.0")
788+
skip_on_r_older_than("3.6")
789789

790790
# no error on conversion, because altrep laziness
791791
v <- expect_error(as.vector(array_with_nul), NA)

r/tests/testthat/test-RecordBatch.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ test_that("Handling string data with embedded nuls", {
626626
# The behavior of the warnings/errors is slightly different with and without
627627
# altrep. Without it (i.e. 3.5.0 and below, the error would trigger immediately
628628
# on `as.vector()` where as with it, the error only happens on materialization)
629-
skip_if_r_version("3.5.0")
629+
skip_on_r_older_than("3.6")
630630
df <- as.data.frame(batch_with_nul)
631631

632632
expect_error(

r/tests/testthat/test-altrep.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
skip_if_r_version("3.5.0")
18+
skip_on_r_older_than("3.6")
1919

2020
test_that("is_arrow_altrep() does not include base altrep", {
2121
expect_false(is_arrow_altrep(1:10))

r/tests/testthat/test-chunked-array.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ test_that("Handling string data with embedded nuls", {
478478
# The behavior of the warnings/errors is slightly different with and without
479479
# altrep. Without it (i.e. 3.5.0 and below, the error would trigger immediately
480480
# on `as.vector()` where as with it, the error only happens on materialization)
481-
skip_if_r_version("3.5.0")
481+
skip_on_r_older_than("3.6")
482482

483483
v <- expect_error(as.vector(chunked_array_with_nul), NA)
484484

r/tests/testthat/test-csv.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ test_that("more informative error when reading a CSV with headers and schema", {
295295
test_that("read_csv_arrow() and write_csv_arrow() accept connection objects", {
296296
# connections with csv need RunWithCapturedR, which is not available
297297
# in R <= 3.4.4
298-
skip_if_r_version("3.4.4")
298+
skip_on_r_older_than("3.5")
299299

300300
tf <- tempfile()
301301
on.exit(unlink(tf))

r/tests/testthat/test-dplyr-funcs-datetime.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
skip_if(on_old_windows())
1919
# In 3.4 the lack of tzone attribute causes spurious failures
20-
skip_if_r_version("3.4.4")
20+
skip_on_r_older_than("3.5")
2121

2222
library(lubridate, warn.conflicts = FALSE)
2323
library(dplyr, warn.conflicts = FALSE)

r/tests/testthat/test-dplyr-funcs-type.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ test_that("format date/time", {
811811
withr::local_locale(LC_TIME = "C")
812812
}
813813
# In 3.4 the lack of tzone attribute causes spurious failures
814-
skip_if_r_version("3.4.4")
814+
skip_on_r_older_than("3.5")
815815

816816
times <- tibble(
817817
datetime = c(lubridate::ymd_hms("2018-10-07 19:04:05", tz = "Pacific/Marquesas"), NA),

r/tests/testthat/test-dplyr-glimpse.R

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18+
# The glimpse output for tests with `example_data` is different on R < 3.6
19+
# because the `lgl` column is generated with `sample()` and the RNG
20+
# algorithm is different in older R versions.
21+
skip_on_r_older_than("3.6")
22+
1823
library(dplyr, warn.conflicts = FALSE)
1924

2025
test_that("glimpse() Table/ChunkedArray", {

r/tests/testthat/test-dplyr-query.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ test_that("No duplicate field names are allowed in an arrow_dplyr_query", {
295295
})
296296

297297
test_that("all_sources() finds all data sources in a query", {
298+
skip_if_not_available("dataset")
298299
tab <- Table$create(a = 1)
299300
ds <- InMemoryDataset$create(tab)
300301
expect_equal(all_sources(tab), list(tab))
@@ -333,6 +334,7 @@ test_that("all_sources() finds all data sources in a query", {
333334
})
334335

335336
test_that("query_on_dataset() looks at all data sources in a query", {
337+
skip_if_not_available("dataset")
336338
tab <- Table$create(a = 1)
337339
ds <- InMemoryDataset$create(tab)
338340
expect_false(query_on_dataset(tab))
@@ -368,6 +370,7 @@ test_that("query_on_dataset() looks at all data sources in a query", {
368370
})
369371

370372
test_that("query_can_stream()", {
373+
skip_if_not_available("dataset")
371374
tab <- Table$create(a = 1)
372375
ds <- InMemoryDataset$create(tab)
373376
expect_true(query_can_stream(tab))

0 commit comments

Comments
 (0)