From 4835e20d1d08203657ab616600286ad9dfd71344 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Wed, 24 May 2017 15:46:44 +0200 Subject: Re-enable PELMO examples and tests - Add .gitattributes to make sure CRLF line endings are kept for PELMO .psm files - Update static docs --- tests/testthat/test_PELMO.R | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'tests') diff --git a/tests/testthat/test_PELMO.R b/tests/testthat/test_PELMO.R index e6d3a0f..be0b410 100644 --- a/tests/testthat/test_PELMO.R +++ b/tests/testthat/test_PELMO.R @@ -19,8 +19,13 @@ runs <- list( psm = "Pesticide_D_1_May_every_other_year_mets", win = names(FOCUS_GW_scenarios_2012$names))) +# Check if we have wine on the path +wine_installed <- system('wine --version', ignore.stdout = TRUE) == 0 + test_that("PELMO paths are correctly created", { - skip("A wine installation is needed for this test") + if (!wine_installed) { + skip("A wine installation is needed for this test") + } psm_paths = c( PELMO_path(runs[[1]]$psm, "fbe", "Por"), PELMO_path(runs[[2]]$psm, "pot", "Ham"), @@ -35,7 +40,9 @@ test_that("PELMO paths are correctly created", { }) test_that("PELMO runs are correctly set up", { - skip("A wine installation is needed for this test") + if (!wine_installed) { + skip("A wine installation is needed for this test") + } # Prepare runs in analogy to the test archive PELMO_runs(runs, psm_dir = PELMO_base, execute = FALSE, evaluate = FALSE, overwrite = TRUE) @@ -59,7 +66,10 @@ test_that("PELMO runs are correctly set up", { }) test_that("PELMO runs can be run and give the expected result files", { - skip("A wine installation is needed for this test") + if (!wine_installed) { + skip("A wine installation is needed for this test") + } + run_PELMO(runs, cores = 7) plm_files <- c("CHEM.PLM", "ECHO.PLM", @@ -88,10 +98,12 @@ test_that("PELMO runs can be run and give the expected result files", { } }) -# pfm_PECgw <- evaluate_PELMO(runs) +pfm_PECgw <- evaluate_PELMO(runs) test_that("PELMO runs are correctly evaluated", { - skip("A wine installation is needed for this test") + if (!wine_installed) { + skip("A wine installation is needed for this test") + } # Check that if output is the same as in the test archive for (run in runs) { @@ -149,7 +161,9 @@ test_that("PELMO runs are correctly evaluated", { }) test_that("PECgw from FOCUS summary files can be reproduced", { - skip("A wine installation is needed for this test") + if (!wine_installed) { + skip("A wine installation is needed for this test") + } focus_summary <- list() for (run in runs) { -- cgit v1.2.1