Skip to content

Commit

Permalink
ML and integration tests don't run on CRAN due to speed [run ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
Neves-P committed Feb 10, 2023
1 parent c028bd3 commit 8252d28
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 7 deletions.
3 changes: 2 additions & 1 deletion tests/testthat/test-DAISIE_ML1.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ context("DAISIE_ML1")

test_that("use", {
skip_if(Sys.getenv("CI") == "", message = "Run only on CI")

skip_on_cran()
data(Galapagos_datalist)
datalist <- Galapagos_datalist
initparsopt <- c(2.5, 2.7, 20, 0.009, 1.01)
Expand Down Expand Up @@ -39,6 +39,7 @@ test_that("use", {

test_that("abuse", {
skip_if(Sys.getenv("CI") == "", message = "Run only on CI")
skip_on_cran()
utils::data(Galapagos_datalist)
datalist <- Galapagos_datalist
initparsopt <- c(2.5, 2.7, 20, 0.009, 1.01)
Expand Down
3 changes: 2 additions & 1 deletion tests/testthat/test-DAISIE_ML2.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
test_that("use", {
skip_if(Sys.getenv("CI") == "", message = "Run only on CI")

skip_on_cran()
utils::data(Macaronesia_datalist, package = "DAISIE")
invisible(capture.output(
tested_MLE <- DAISIE_ML2(
Expand Down Expand Up @@ -59,6 +59,7 @@ test_that("use", {

test_that("abuse", {
skip_if(Sys.getenv("CI") == "", message = "Run only on CI")
skip_on_cran()
expect_error(tested_MLE <- DAISIE:::DAISIE_ML2(
datalist = "nonsense",
initparsopt = c(
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-DAISIE_ML4.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ test_that("DAISIE_ML4 is silent and produces correct output", {
test_that("DAISIE_loglik_all_choosepar4 is silent and produces correct output", {
utils::data(Galapagos_datalist)
skip_if(Sys.getenv("CI") == "", message = "Run only on CI")
skip_on_cran()
# Throws warnings and DLSODES output
invisible(capture.output(suppressWarnings(
output <- DAISIE_loglik_all_choosepar4(
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-DAISIE_MW_ML.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
test_that("DAISIE_MW_ML produces correct output", {

skip_if(Sys.getenv("CI") == "", message = "Run only on CI")

skip_on_cran()


utils::data(archipelagos41)
Expand Down
9 changes: 7 additions & 2 deletions tests/testthat/test-DAISIE_loglik_CS.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
test_that("DAISIE_loglik_CS_choice produces correct output for CS_version 1", {
skip_if(Sys.getenv("CI") == "", message = "Run only on CI")
skip_on_cran()
pars1 <- c(2.000, 2.700, 20.000, 0.009, 1.010)
pars2 <- c(1.0e+02, 1.1e+01, 0.0e+00, 0.0e+00, NA, 0.0e+00, 1.0e-04,
1.0e-05, 1.0e-07, 3.0e+03, 9.5e-01, 9.8e-01)
Expand All @@ -21,6 +22,7 @@ test_that("DAISIE_loglik_CS_choice produces correct output for CS_version 1", {
test_that("DAISIE_loglik_CS_choice produces correct output for relaxed-rate
model (CS_version = 2)", {
skip_if(Sys.getenv("CI") == "", message = "Run only on CI")
skip_on_cran()
pars1 <- c(2.000, 2.700, 20.000, 0.009, 1.010)
pars2 <- c(1.0e+02, 1.1e+01, 0.0e+00, 0.0e+00, NA, 0.0e+00, 1.0e-04,
1.0e-05, 1.0e-07, 3.0e+03, 9.5e-01, 9.8e-01)
Expand All @@ -46,7 +48,7 @@ test_that("DAISIE_loglik_CS_choice produces correct output for relaxed-rate

test_that("DAISIE_loglik_CS_choice produces same output for CS_version = 0
(with M = 1) and CS_version = 1 ", {

skip_on_cran()
skip_if(Sys.getenv("CI") == "", message = "Run only on CI")
pars1 <- c(2.000, 2.700, 20.000, 0.009, 1.010)
pars2 <- c(100, 11, 0, 0, NA, 0.0e+00, 1.0e-04,
Expand Down Expand Up @@ -77,6 +79,7 @@ test_that("DAISIE_loglik_CS_choice produces same output for CS_version = 0

test_that("DAISIE_loglik_all produces correct output for relaxed-rate model", {
skip_if(Sys.getenv("CI") == "", message = "Run only on CI")
skip_on_cran()
utils::data(Galapagos_datalist)
invisible(capture.output(suppressWarnings(
loglik <- DAISIE::DAISIE_loglik_all(
Expand All @@ -98,6 +101,7 @@ test_that("DAISIE_loglik_all produces correct output for relaxed-rate model", {

test_that("DAISIE_loglik produces correct output", {
skip_if(Sys.getenv("CI") == "", message = "Run only on CI")
skip_on_cran()
output <- DAISIE_loglik(pars1 = c(2.061154e-09, 2.683455e+00, 1.000000e+01,
9.332070e-03, 1.010073e+00),
pars2 = c(100, 0, 0, 0, NA),
Expand All @@ -115,7 +119,7 @@ test_that("DAISIE_loglik produces correct output", {
test_that("DAISIE_loglik_all produces same output for CS_version 0 and 1 with
and without conditioning", {
skip_if(Sys.getenv("CI") == "", message = "Run only on CI")

skip_on_cran()
utils::data(Galapagos_datalist)
Galapagos_datalist2 <- Galapagos_datalist
for(i in 2:9) {
Expand Down Expand Up @@ -162,6 +166,7 @@ test_that("DAISIE_loglik_all produces same output for CS_version 0 and 1 with
test_that("DAISIE_loglik_CS_choice produces equivalent output for ODEINT RKCK54
and deSolve lsodes", {
skip_if(Sys.getenv("CI") == "", message = "Run only on CI")
skip_on_cran()
pars1 <- c(2.000, 2.700, 20.000, 0.009, 1.010)
pars2 <- c(1.0e+02, 1.1e+01, 0.0e+00, 0.0e+00, NA, 0.0e+00, 1.0e-04,
1.0e-05, 1.0e-07, 3.0e+03, 9.5e-01, 9.8e-01)
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-DAISIE_loglik_IW_solver.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
test_that("IW and CS loglik is same when K = Inf", {
skip_if(Sys.getenv("CI") == "", message = "Run only on CI")

skip_on_cran()
utils::data(Galapagos_datalist, package = "DAISIE")
pars1 <- c(0.35, 0.3, Inf, 0.001, 0.3)
pars2 <- c(120, 11, 0, 1)
Expand Down Expand Up @@ -51,7 +51,7 @@ test_that("loglik IW various solver options give similar results", {
# Test is not included in coverage due to issue with running loglik_IW
# code from covr::package_coverage()
testthat::skip_on_covr()

skip_on_cran()
utils::data(frogs_datalist, package = "DAISIE")
pars1 <- c(0.2, 0.1, 1000.1, 0.001, 0.3)
pars2 <- c(40, 11, 0, 0)
Expand Down
4 changes: 4 additions & 0 deletions tests/testthat/test-integration_DAISIE.R
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ test_that("clade specific rate-shift loglik works", {
test_that("IW and CS loglik is same when K = Inf", {
skip_if(Sys.getenv("CI") == "" && !(Sys.getenv("USERNAME") == "rampa"),
message = "Run only on CI")
skip_on_cran()
data(Galapagos_datalist, package = "DAISIE")
pars1 <- c(0.35, 0.3, Inf, 0.001, 0.3)
pars2 <- c(80, 11, 1, 0)
Expand Down Expand Up @@ -103,6 +104,7 @@ test_that("IW and CS loglik is same when K = Inf", {
test_that("DAISIE_ML simple case works", {
skip_if(Sys.getenv("CI") == "" && !(Sys.getenv("USERNAME") == "rampa"),
message = "Run only on CI")
skip_on_cran()
expected_mle <- data.frame(
lambda_c = 2.583731356303842,
mu = 2.708828027514834,
Expand Down Expand Up @@ -131,6 +133,7 @@ test_that("DAISIE_ML simple case works", {
test_that("DAISIE_ML simple case works with zero probability of initial presence", {
skip_if(Sys.getenv("CI") == "" && !(Sys.getenv("USERNAME") == "rampa"),
message = "Run only on CI")
skip_on_cran()
expected_mle <- data.frame(
lambda_c = 2.583731356303842,
mu = 2.708828027514834,
Expand Down Expand Up @@ -190,6 +193,7 @@ test_that("DAISIE_ML simple case works with estimating probability of initial
presence", {
skip_if(Sys.getenv("CI") == "" && !(Sys.getenv("USERNAME") == "rampa"),
message = "Run only on CI")
skip_on_cran()

expected_mle <- data.frame(
lambda_c = 2.54079308283855,
Expand Down

0 comments on commit 8252d28

Please sign in to comment.