Skip to content

Commit a0b4ad0

Browse files
committed
Actually, we need a different function
1 parent 3136979 commit a0b4ad0

1 file changed

Lines changed: 12 additions & 16 deletions

File tree

‎r/extra-tests/test-read-files.R‎

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,20 @@
1818
library(arrow)
1919
library(testthat)
2020

21-
# These are copied from tests/testthat/helper-skip.R so we don't need to load all of
22-
# the helpers.
23-
if_version_less_than <- function(version) {
24-
arrow_cpp_version() < numeric_version(version)
25-
}
26-
27-
skip_if_arrow_version_less_than <- function(version, msg) {
28-
if (if_version_less_than(version)) {
29-
skip(msg)
30-
}
21+
# These are similar to functions in tests/testthat/helper-skip.R but we duplicate them
22+
# here since very old versions don't have arrow_info() with exactly the same shape
23+
if_version <- function(version, op = `==`) {
24+
op(packageVersion("arrow"), version)
3125
}
3226

3327
if_version_less_than <- function(version) {
34-
arrow_cpp_version() < numeric_version(version)
28+
if_version(version, op = `<`)
3529
}
3630

37-
arrow_cpp_version <- function() {
38-
numeric_version(gsub("-SNAPSHOT", "", arrow::arrow_info()$build_info["cpp_version"]))
31+
skip_if_version_less_than <- function(version, msg) {
32+
if (if_version(version, `<`)) {
33+
skip(msg)
34+
}
3935
}
4036

4137
pq_file <- "files/ex_data.parquet"
@@ -50,7 +46,7 @@ test_that("Can read the file (parquet)", {
5046

5147
### Parquet
5248
test_that("Can see the metadata (parquet)", {
53-
skip_if_arrow_version_less_than("2.0.0", "Version 1.0.1 can't read new version metadata.")
49+
skip_if_version_less_than("2.0.0", "Version 1.0.1 can't read new version metadata.")
5450

5551
df <- read_parquet(pq_file)
5652
expect_s3_class(df, "tbl")
@@ -94,7 +90,7 @@ for (comp in c("lz4", "uncompressed", "zstd")) {
9490
})
9591

9692
test_that(paste0("Can see the metadata (feather ", comp, ")"), {
97-
skip_if_arrow_version_less_than("2.0.0", "Version 1.0.1 can't read new version metadata.")
93+
skip_if_version_less_than("2.0.0", "Version 1.0.1 can't read new version metadata.")
9894

9995
df <- read_feather(feather_file)
10096
expect_s3_class(df, "tbl")
@@ -152,7 +148,7 @@ test_that("Can read the file (parquet)", {
152148
})
153149

154150
test_that("Can see the metadata (stream)", {
155-
skip_if_arrow_version_less_than("2.0.0", "Version 1.0.1 can't read new version metadata.")
151+
skip_if_version_less_than("2.0.0", "Version 1.0.1 can't read new version metadata.")
156152
df <- read_ipc_stream(stream_file)
157153

158154
expect_s3_class(df, "tbl")

0 commit comments

Comments
 (0)