From 257cb81c6a5d352dadc4a86989d219489c492b67 Mon Sep 17 00:00:00 2001 From: ThimotheeV Date: Wed, 19 Aug 2026 16:22:53 +0200 Subject: [PATCH] adapt test to test suite env --- man/treepplr-package.Rd | 2 ++ tests/testthat/test-data.R | 4 ++++ tests/testthat/test-model.R | 8 ++++++++ 3 files changed, 14 insertions(+) diff --git a/man/treepplr-package.Rd b/man/treepplr-package.Rd index 108d026..aa86ce6 100644 --- a/man/treepplr-package.Rd +++ b/man/treepplr-package.Rd @@ -23,6 +23,8 @@ Useful links: Authors: \itemize{ \item Mariana P Braga \email{mpiresbr@gmail.com} (\href{https://orcid.org/0000-0002-1253-2536}{ORCID}) + \item Tim Virgoulay + \item Stenio Foerster } } diff --git a/tests/testthat/test-data.R b/tests/testthat/test-data.R index d162ab4..198abe9 100644 --- a/tests/testthat/test-data.R +++ b/tests/testthat/test-data.R @@ -11,6 +11,10 @@ test_that("Test-data_1a : tp_data name", { version <- list.files("/tmp", pattern = paste0("treeppl-", TPPLC_VERSION), full.names = TRUE) + if (length(version) == 0) { + version <- unlist(strsplit(Sys.getenv("MCORE_LIBS"), "treeppl="))[2] + } + data_right <- system(paste0("find ", version, " -name testdata_coin.json"), intern = T) data <- treepplr::tp_data("coin") diff --git a/tests/testthat/test-model.R b/tests/testthat/test-model.R index a2cd77f..5c3805d 100644 --- a/tests/testthat/test-model.R +++ b/tests/testthat/test-model.R @@ -33,6 +33,10 @@ test_that("Test-model_2a : tp_compile model name", { pattern = paste0("treeppl-", TPPLC_VERSION), full.names = TRUE) + if (length(version) == 0) { + version <- unlist(strsplit(Sys.getenv("MCORE_LIBS"), "treeppl="))[2] + } + model_right = system(paste0("find ", version, " -name crbd.tppl"), intern = T) expect_equal(readr::read_file(sampler$model_path), readr::read_file(model_right)) @@ -45,6 +49,10 @@ test_that("Test-model_2b : tp_compile model path ", { pattern = paste0("treeppl-", TPPLC_VERSION), full.names = TRUE) + if (length(version) == 0) { + version <- unlist(strsplit(Sys.getenv("MCORE_LIBS"), "treeppl="))[2] + } + model_right = system(paste0("find ", version, " -name crbd.tppl"), intern = T) sampler <- treepplr::tp_compile(model_right)