Skip to content

[SPARK-15091][SPARKR] Fix warnings and a failure in SparkR test cases with testthat version 1.0.1 #12867

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion R/pkg/inst/tests/testthat/test_client.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ test_that("no package specified doesn't add packages flag", {
})

test_that("multiple packages don't produce a warning", {
expect_that(generateSparkSubmitArgs("", "", "", "", c("A", "B")), not(gives_warning()))
expect_warning(generateSparkSubmitArgs("", "", "", "", c("A", "B")), NA)
})

test_that("sparkJars sparkPackages as character vectors", {
Expand Down
2 changes: 1 addition & 1 deletion R/pkg/inst/tests/testthat/test_context.R
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ test_that("sparkJars sparkPackages as comma-separated strings", {

# check normalizePath
f <- dir()[[1]]
expect_that(processSparkJars(f), not(gives_warning()))
expect_warning(processSparkJars(f), NA)
expect_match(processSparkJars(f), f)
})

Expand Down
4 changes: 2 additions & 2 deletions R/pkg/inst/tests/testthat/test_mllib.R
Original file line number Diff line number Diff line change
Expand Up @@ -450,9 +450,9 @@ test_that("spark.survreg", {
if (requireNamespace("survival", quietly = TRUE)) {
rData <- list(time = c(4, 3, 1, 1, 2, 2, 3), status = c(1, 1, 1, 0, 1, 1, 0),
x = c(0, 2, 1, 1, 1, 0, 0), sex = c(0, 0, 0, 0, 1, 1, 1))
expect_that(
expect_error(
model <- survival::survreg(formula = survival::Surv(time, status) ~ x + sex, data = rData),
not(throws_error()))
NA)
expect_equal(predict(model, rData)[[1]], 3.724591, tolerance = 1e-4)
}
})
11 changes: 5 additions & 6 deletions R/pkg/inst/tests/testthat/test_sparkSQL.R
Original file line number Diff line number Diff line change
Expand Up @@ -1196,9 +1196,9 @@ test_that("date functions on a DataFrame", {
c(as.POSIXlt("2012-12-13 21:34:00 UTC"), as.POSIXlt("2014-12-15 10:24:34 UTC")))
expect_equal(collect(select(df2, to_utc_timestamp(df2$b, "JST")))[, 1],
c(as.POSIXlt("2012-12-13 03:34:00 UTC"), as.POSIXlt("2014-12-14 16:24:34 UTC")))
expect_more_than(collect(select(df2, unix_timestamp()))[1, 1], 0)
expect_more_than(collect(select(df2, unix_timestamp(df2$b)))[1, 1], 0)
expect_more_than(collect(select(df2, unix_timestamp(lit("2015-01-01"), "yyyy-MM-dd")))[1, 1], 0)
expect_gt(collect(select(df2, unix_timestamp()))[1, 1], 0)
expect_gt(collect(select(df2, unix_timestamp(df2$b)))[1, 1], 0)
expect_gt(collect(select(df2, unix_timestamp(lit("2015-01-01"), "yyyy-MM-dd")))[1, 1], 0)

l3 <- list(list(a = 1000), list(a = -1000))
df3 <- createDataFrame(sqlContext, l3)
Expand Down Expand Up @@ -1502,15 +1502,14 @@ test_that("toJSON() returns an RDD of the correct values", {

test_that("showDF()", {
df <- read.json(sqlContext, jsonPath)
s <- capture.output(showDF(df))
expected <- paste("+----+-------+\n",
"| age| name|\n",
"+----+-------+\n",
"|null|Michael|\n",
"| 30| Andy|\n",
"| 19| Justin|\n",
"+----+-------+\n", sep = "")
expect_output(s, expected)
expect_output(showDF(df), expected)
})

test_that("isLocal()", {
Expand Down Expand Up @@ -1896,7 +1895,7 @@ test_that("Method as.data.frame as a synonym for collect()", {
expect_equal(as.data.frame(irisDF2), collect(irisDF2))

# Make sure as.data.frame in the R base package is not covered
expect_that(as.data.frame(c(1, 2)), not(throws_error()))
expect_error(as.data.frame(c(1, 2)), NA)
})

test_that("attach() on a DataFrame", {
Expand Down