This is an automated email from the ASF dual-hosted git repository.
jonkeane pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/main by this push:
new 5e52077e2f MINOR: Move tests, skip when no dataset is available
(#42233)
5e52077e2f is described below
commit 5e52077e2fc98febe5a62fd70efce282dc4fc2e1
Author: Jonathan Keane <[email protected]>
AuthorDate: Thu Jun 20 20:22:26 2024 -0500
MINOR: Move tests, skip when no dataset is available (#42233)
Update tests that are making our minimal builds fail. The tests are
unchanged and no new functionality is added. I moved the tests that were
failing to the end of their blocks and added `skip_if_not_available("dataset")`
since our minimal builds _don't_ include datasets and thus the snapshots that
use datasets will be wrong there.
Authored-by: Jonathan Keane <[email protected]>
Signed-off-by: Jonathan Keane <[email protected]>
---
r/tests/testthat/test-dplyr-across.R | 17 ++++++++-------
r/tests/testthat/test-dplyr-eval.R | 1 +
r/tests/testthat/test-dplyr-funcs-datetime.R | 31 ++++++++++++++--------------
3 files changed, 26 insertions(+), 23 deletions(-)
diff --git a/r/tests/testthat/test-dplyr-across.R
b/r/tests/testthat/test-dplyr-across.R
index cfdad9a1f4..5396dcbe79 100644
--- a/r/tests/testthat/test-dplyr-across.R
+++ b/r/tests/testthat/test-dplyr-across.R
@@ -116,14 +116,6 @@ test_that("expand_across correctly expands quosures", {
example_data
)
- # ellipses (...) are a deprecated argument
- # abandon_ship message offers multiple suggestions
- expect_snapshot(
- InMemoryDataset$create(example_data) %>%
- mutate(across(c(dbl, dbl2), round, digits = -1)),
- error = TRUE
- )
-
# alternative ways of specifying .fns - as a list
expect_across_equal(
quos(across(1:dbl2, list(round))),
@@ -230,6 +222,15 @@ test_that("expand_across correctly expands quosures", {
),
example_data
)
+
+ skip_if_not_available("dataset")
+ # ellipses (...) are a deprecated argument
+ # abandon_ship message offers multiple suggestions
+ expect_snapshot(
+ InMemoryDataset$create(example_data) %>%
+ mutate(across(c(dbl, dbl2), round, digits = -1)),
+ error = TRUE
+ )
})
test_that("purrr-style lambda functions are supported", {
diff --git a/r/tests/testthat/test-dplyr-eval.R
b/r/tests/testthat/test-dplyr-eval.R
index 16c56f28cd..0b0b9f98f4 100644
--- a/r/tests/testthat/test-dplyr-eval.R
+++ b/r/tests/testthat/test-dplyr-eval.R
@@ -53,6 +53,7 @@ test_that("try_arrow_dplyr/abandon_ship adds the right
message about collect()",
})
}
+ skip_if_not_available("dataset")
ds <- InMemoryDataset$create(arrow_table(x = 1))
for (i in 0:2) {
expect_snapshot(tester(ds, i), error = TRUE)
diff --git a/r/tests/testthat/test-dplyr-funcs-datetime.R
b/r/tests/testthat/test-dplyr-funcs-datetime.R
index 0e4d2f3656..e53daf8317 100644
--- a/r/tests/testthat/test-dplyr-funcs-datetime.R
+++ b/r/tests/testthat/test-dplyr-funcs-datetime.R
@@ -1885,21 +1885,6 @@ test_that("`as.Date()` and `as_date()`", {
test_df
)
- # we do not support multiple tryFormats
- # Use a dataset to test the alternative suggestion message
- expect_snapshot(
- test_df %>%
- InMemoryDataset$create() %>%
- transmute(
- date_char_ymd = as.Date(
- character_ymd_var,
- tryFormats = c("%Y-%m-%d", "%Y/%m/%d")
- )
- ) %>%
- collect(),
- error = TRUE
- )
-
# strptime does not support a partial format - Arrow returns NA, while
# lubridate parses correctly
# TODO: revisit after ARROW-15813
@@ -1957,6 +1942,22 @@ test_that("`as.Date()` and `as_date()`", {
collect(),
test_df
)
+
+ skip_if_not_available("dataset")
+ # we do not support multiple tryFormats
+ # Use a dataset to test the alternative suggestion message
+ expect_snapshot(
+ test_df %>%
+ InMemoryDataset$create() %>%
+ transmute(
+ date_char_ymd = as.Date(
+ character_ymd_var,
+ tryFormats = c("%Y-%m-%d", "%Y/%m/%d")
+ )
+ ) %>%
+ collect(),
+ error = TRUE
+ )
})
test_that("`as_date()` and `as.Date()` work with R objects", {