From 03c3035ca01c66b6a1352f7e509753fe2d057af2 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Wed, 11 Jul 2018 03:41:43 +0200 Subject: Improve PELMO tests --- tests/testthat/test_PELMO.R | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) (limited to 'tests') diff --git a/tests/testthat/test_PELMO.R b/tests/testthat/test_PELMO.R index 49c03d3..ba6a04a 100644 --- a/tests/testthat/test_PELMO.R +++ b/tests/testthat/test_PELMO.R @@ -21,11 +21,12 @@ runs <- list( # Check if we have wine on the path wine_installed <- system('wine --version', ignore.stdout = TRUE) == 0 +skip_if_no_wine <- function() { + if (!wine_installed) skip("wine is not available") +} test_that("PELMO paths are correctly created", { - if (!wine_installed) { - skip("A wine installation is needed for this test") - } + skip_if_no_wine() psm_paths = c( PELMO_path(runs[[1]]$psm, "fbe", "Por"), PELMO_path(runs[[2]]$psm, "pot", "Ham"), @@ -40,9 +41,7 @@ test_that("PELMO paths are correctly created", { }) test_that("PELMO runs are correctly set up", { - if (!wine_installed) { - skip("A wine installation is needed for this test") - } + skip_if_no_wine() # Prepare runs in analogy to the test archive skip_on_cran() @@ -67,11 +66,9 @@ test_that("PELMO runs are correctly set up", { }) test_that("PELMO runs can be run and give the expected result files", { - if (!wine_installed) { - skip("A wine installation is needed for this test") - } - + skip_if_no_wine() skip_on_cran() + run_PELMO(runs, cores = 7) plm_files <- c("CHEM.PLM", "ECHO.PLM", @@ -104,14 +101,12 @@ test_that("PELMO runs can be run and give the expected result files", { } }) -pfm_PECgw <- evaluate_PELMO(runs) - test_that("PELMO runs are correctly evaluated", { - if (!wine_installed) { - skip("A wine installation is needed for this test") - } - + skip_if_no_wine() skip_on_cran() + + pfm_PECgw <- evaluate_PELMO(runs) + # Check that if output is the same as in the test archive for (run in runs) { psm <- run$psm @@ -168,10 +163,11 @@ test_that("PELMO runs are correctly evaluated", { }) test_that("PECgw from FOCUS summary files can be reproduced", { - if (!wine_installed) { - skip("A wine installation is needed for this test") - } + skip_if_no_wine() skip_on_cran() + + pfm_PECgw <- evaluate_PELMO(runs) + focus_summary <- list() for (run in runs) { -- cgit v1.2.1