From a626a4d7326d68e8363ad4a4d51877a30a3ea691 Mon Sep 17 00:00:00 2001 From: pat-s Date: Thu, 1 Sep 2022 14:30:34 +0200 Subject: [PATCH] account for some warnings in tests --- .github/workflows/tic.yml | 2 ++ tests/testthat/test_makeMBOLearner.R | 2 +- tests/testthat/test_plot_MBOResult.R | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tic.yml b/.github/workflows/tic.yml index fafcb9908..83d9a6a7a 100644 --- a/.github/workflows/tic.yml +++ b/.github/workflows/tic.yml @@ -32,6 +32,8 @@ jobs: - { os: ubuntu-latest, r: "release", pkgdown: "true" } env: + # [Custom env var] fake virtual display for rgl package + DISPLAY: ":99" # make sure to run `tic::use_ghactions_deploy()` to set up deployment TIC_DEPLOY_KEY: ${{ secrets.TIC_DEPLOY_KEY }} # prevent rgl issues because no X11 display is available diff --git a/tests/testthat/test_makeMBOLearner.R b/tests/testthat/test_makeMBOLearner.R index 706c12695..985437b06 100644 --- a/tests/testthat/test_makeMBOLearner.R +++ b/tests/testthat/test_makeMBOLearner.R @@ -43,7 +43,7 @@ test_that("makeMBOLearner", { lrn = makeMBOLearner(ctrl, f) expect_equal(lrn, makeLearner("regr.km", predict.type = "se", par.vals = list(covtype = "matern3_2", optim.method = "gen", nugget.estim = TRUE, jitter = TRUE ))) - expect_output(print(mbo(f, control = ctrl, learner = lrn)), "Recommended parameters") + expect_output(suppressWarnings(print(mbo(f, control = ctrl, learner = lrn)), "Recommended parameters")) # discrete case diff --git a/tests/testthat/test_plot_MBOResult.R b/tests/testthat/test_plot_MBOResult.R index 5d5d6d6f0..83e3046b9 100644 --- a/tests/testthat/test_plot_MBOResult.R +++ b/tests/testthat/test_plot_MBOResult.R @@ -13,7 +13,7 @@ test_that("plot single-objective", { opt.focussearch.maxit = 3L) or = mbo(f, des, learner = learner, control = ctrl) - plot(or, iters = 0:2, pause = FALSE) + suppressWarnings(plot(or, iters = 0:2, pause = FALSE)) }) test_that("plot multi-objective", { @@ -30,5 +30,5 @@ test_that("plot multi-objective", { ctrl = setMBOControlMultiObj(ctrl, method = "mspot") or = mbo(f, des, learner = learner, control = ctrl) - plot(or, iters = 0:2, pause = FALSE) + suppressWarnings(plot(or, iters = 0:2, pause = FALSE)) })