diff options
Diffstat (limited to 'tests/testthat')
-rw-r--r-- | tests/testthat/test_error_models.R | 13 | ||||
-rw-r--r-- | tests/testthat/test_nafta.R | 8 |
2 files changed, 14 insertions, 7 deletions
diff --git a/tests/testthat/test_error_models.R b/tests/testthat/test_error_models.R index 33e44bf8..fbae6286 100644 --- a/tests/testthat/test_error_models.R +++ b/tests/testthat/test_error_models.R @@ -91,14 +91,17 @@ test_that("Reweighting method 'tc' produces reasonable variance estimates", { sdfunc = function(x) sigma_twocomp(x, 0.5, 0.07), n = 1, reps = 100, digits = 5, LOD = -Inf, seed = 123456) - # Per default (on my box) use all cores minus one - n_cores <- parallel::detectCores() - 1 + # Per default (on my box where I set NOT_CRAN) use all cores minus one + if (identical(Sys.getenv("NOT_CRAN"), "true")) { + n_cores <- parallel::detectCores() - 1 + } else { + n_cores <- 1 + } - # We are only allowed one core on travis + # We are only allowed one core on travis, but they also set NOT_CRAN=true if (Sys.getenv("TRAVIS") != "") n_cores = 1 - # Also on Windows we would need to make a cluster first, - # and I do not know how this would work on winbuilder or CRAN, so + # On Windows we would need to make a cluster first if (Sys.info()["sysname"] == "Windows") n_cores = 1 # Unweighted fits diff --git a/tests/testthat/test_nafta.R b/tests/testthat/test_nafta.R index 096287aa..8cb1895b 100644 --- a/tests/testthat/test_nafta.R +++ b/tests/testthat/test_nafta.R @@ -39,7 +39,9 @@ test_that("Test data from Appendix B are correctly evaluated", { expect_known_output(print(res), "NAFTA_SOP_Appendix_B.txt") plot_nafta <- function() plot(res) - vdiffr::expect_doppelganger("NAFTA SOP Appendix B", plot_nafta) + if(requireNamespace("vdiffr", quietly = TRUE)) { + vdiffr::expect_doppelganger("NAFTA SOP Appendix B", plot_nafta) + } }) test_that("Test data from Appendix D are correctly evaluated", { @@ -61,5 +63,7 @@ test_that("Test data from Appendix D are correctly evaluated", { expect_known_output(print(res), "NAFTA_SOP_Appendix_D.txt") plot_nafta <- function() plot(res) - vdiffr::expect_doppelganger("Plot NAFTA analysis", plot_nafta) + if(requireNamespace("vdiffr", quietly = TRUE)) { + vdiffr::expect_doppelganger("Plot NAFTA analysis", plot_nafta) + } }) |