You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by gu...@apache.org on 2020/11/02 02:17:28 UTC
[spark] branch branch-2.4 updated:
[SPARK-33313][TESTS][R][3.0][2.4] Add testthat 3.x support
This is an automated email from the ASF dual-hosted git repository.
gurwls223 pushed a commit to branch branch-2.4
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-2.4 by this push:
new 1bbba60 [SPARK-33313][TESTS][R][3.0][2.4] Add testthat 3.x support
1bbba60 is described below
commit 1bbba6015c2c01f3b8a57e34af8f645d0af880f3
Author: HyukjinKwon <gu...@apache.org>
AuthorDate: Mon Nov 2 11:10:39 2020 +0900
[SPARK-33313][TESTS][R][3.0][2.4] Add testthat 3.x support
### What changes were proposed in this pull request?
This PR proposes to port back https://github.com/apache/spark/pull/30219 but keeps testthat 1.x support in other branches.
This PR modifies `R/pkg/tests/run-all.R` by:
- ~Removing `testthat` 1.x support, as Jenkins has been upgraded to 2.x with SPARK-30637 and this code is no longer relevant.~
- Add `testthat` 3.x support to avoid CI failures.
### Why are the changes needed?
Currently used internal API has been removed in the latest `testthat` release.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Tests executed against `testthat == 2.3.2` and `testthat == 3.0.0`
Closes #30220 from HyukjinKwon/SPARK-33313.
Lead-authored-by: HyukjinKwon <gu...@apache.org>
Co-authored-by: zero323 <ms...@gmail.com>
Signed-off-by: HyukjinKwon <gu...@apache.org>
(cherry picked from commit 131179a799c6e162b804d7e997a564ca21464120)
Signed-off-by: HyukjinKwon <gu...@apache.org>
---
R/pkg/tests/run-all.R | 48 ++++++++++++++++++++++++++++++++++++------------
1 file changed, 36 insertions(+), 12 deletions(-)
diff --git a/R/pkg/tests/run-all.R b/R/pkg/tests/run-all.R
index 20e61b2..0a6a6c4 100644
--- a/R/pkg/tests/run-all.R
+++ b/R/pkg/tests/run-all.R
@@ -60,25 +60,49 @@ if (identical(Sys.getenv("NOT_CRAN"), "true")) {
# set random seed for predictable results. mostly for base's sample() in tree and classification
set.seed(42)
- # TODO (SPARK-30663) To be removed once testthat 1.x is removed from all builds
- if (packageVersion("testthat")$major <= 1) {
+ test_runner <- if (packageVersion("testthat")$major <= 1) {
# testthat 1.x
- test_runner <- testthat:::run_tests
- reporter <- "summary"
+ function(path, package, reporter, filter) {
+ testthat:::run_tests(
+ test_path = path,
+ package = package,
+ filter = filter,
+ reporter = reporter
+ )
+ }
+ } else if (packageVersion("testthat")$major == 2) {
+ # testthat >= 2.0.0, < 3.0.0
+ function(path, package, reporter, filter) {
+ testthat:::test_package_dir(
+ test_path = path,
+ package = package,
+ filter = filter,
+ reporter = reporter
+ )
+ }
+ } else {
+ # testthat >= 3.0.0
+ testthat::test_dir
+ }
+
+ reporter <- if (packageVersion("testthat")$major <= 1) {
+ "summary"
} else {
- # testthat >= 2.0.0
- test_runner <- testthat:::test_package_dir
dir.create("target/test-reports", showWarnings = FALSE)
- reporter <- MultiReporter$new(list(
+ MultiReporter$new(list(
SummaryReporter$new(),
- JunitReporter$new(file = "target/test-reports/test-results.xml")
+ JunitReporter$new(
+ file = file.path(getwd(), "target/test-reports/test-results.xml")
+ )
))
}
- test_runner("SparkR",
- file.path(sparkRDir, "pkg", "tests", "fulltests"),
- NULL,
- reporter)
+ test_runner(
+ path = file.path(sparkRDir, "pkg", "tests", "fulltests"),
+ package = "SparkR",
+ reporter = reporter,
+ filter = NULL
+ )
}
SparkR:::uninstallDownloadedSpark()
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org