From 90e463c8c52d5ae49e4bd8bc7ec61d2eb189bf9d Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sat, 7 Nov 2020 00:27:53 -0600 Subject: [PATCH 1/2] [R-package] fix learning-to-rank tests on Solaris --- R-package/tests/testthat/test_learning_to_rank.R | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/R-package/tests/testthat/test_learning_to_rank.R b/R-package/tests/testthat/test_learning_to_rank.R index 0d6303139500..2bbffc54652c 100644 --- a/R-package/tests/testthat/test_learning_to_rank.R +++ b/R-package/tests/testthat/test_learning_to_rank.R @@ -3,6 +3,8 @@ context("Learning to rank") # numerical tolerance to use when checking metric values TOLERANCE <- 1e-06 +ON_SOLARIS <- Sys.info()['sysname'] == "SunOS" + test_that("learning-to-rank with lgb.train() works as expected", { set.seed(708L) data(agaricus.train, package = "lightgbm") @@ -46,11 +48,14 @@ test_that("learning-to-rank with lgb.train() works as expected", { } expect_identical(sapply(eval_results, function(x) {x$name}), eval_names) expect_equal(eval_results[[1L]][["value"]], 0.775) - expect_true(abs(eval_results[[2L]][["value"]] - 0.745986) < TOLERANCE) - expect_true(abs(eval_results[[3L]][["value"]] - 0.7351959) < TOLERANCE) + if (!ON_SOLARIS) { + expect_true(abs(eval_results[[2L]][["value"]] - 0.745986) < TOLERANCE) + expect_true(abs(eval_results[[3L]][["value"]] - 0.7351959) < TOLERANCE) + } }) test_that("learning-to-rank with lgb.cv() works as expected", { + testthat::skip_if(ON_SOLARIS, message = "Skipping on Solaris") set.seed(708L) data(agaricus.train, package = "lightgbm") # just keep a few features,to generate an model with imperfect fit From 1712a148fd85ca7ede277e1af1e55f7fca8a4963 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Sat, 7 Nov 2020 20:26:04 +0000 Subject: [PATCH 2/2] Update R-package/tests/testthat/test_learning_to_rank.R Co-authored-by: Nikita Titov --- R-package/tests/testthat/test_learning_to_rank.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R-package/tests/testthat/test_learning_to_rank.R b/R-package/tests/testthat/test_learning_to_rank.R index 2bbffc54652c..5ab4a391bd84 100644 --- a/R-package/tests/testthat/test_learning_to_rank.R +++ b/R-package/tests/testthat/test_learning_to_rank.R @@ -3,7 +3,7 @@ context("Learning to rank") # numerical tolerance to use when checking metric values TOLERANCE <- 1e-06 -ON_SOLARIS <- Sys.info()['sysname'] == "SunOS" +ON_SOLARIS <- Sys.info()["sysname"] == "SunOS" test_that("learning-to-rank with lgb.train() works as expected", { set.seed(708L)