Skip to content

Commit 030cb2c

Browse files
authored
Merge pull request #325 from MichaelChirico/patch-1
Skip tests depending on Suggested dependency rstantools
2 parents 11e4aa8 + 075eb52 commit 030cb2c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

tests/testthat/test-ppc-errors.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ context("PPC: predictive errors")
44
source(test_path("data-for-ppc-tests.R"))
55

66
test_that("ppc_error_hist and ppc_error_scatter return ggplot object", {
7+
skip_if_not_installed("rstantools")
78
expect_gg(ppc_error_hist(y, yrep[1:5, ], binwidth = 0.1))
89
expect_gg(ppc_error_scatter(y, yrep[1:5, ]))
910

@@ -15,17 +16,20 @@ test_that("ppc_error_hist and ppc_error_scatter return ggplot object", {
1516
})
1617

1718
test_that("ppc_error_hist_grouped returns ggplot object", {
19+
skip_if_not_installed("rstantools")
1820
expect_gg(ppc_error_hist_grouped(y, yrep[1:5, ], group, binwidth = 0.1))
1921
expect_gg(ppc_error_hist_grouped(y, yrep[1,, drop = FALSE], group,
2022
freq = FALSE, binwidth = 1))
2123
})
2224

2325
test_that("ppc_error_scatter_avg returns ggplot2 object", {
26+
skip_if_not_installed("rstantools")
2427
expect_gg(ppc_error_scatter_avg(y, yrep))
2528
expect_gg(ppc_error_scatter_avg(y, yrep[1:5, ]))
2629
})
2730

2831
test_that("ppc_error_scatter_avg same as ppc_error_scatter if nrow(yrep) = 1", {
32+
skip_if_not_installed("rstantools")
2933
p1 <- ppc_error_scatter_avg(y2, yrep2)
3034
p2 <- ppc_error_scatter(y2, yrep2)
3135
d1 <- p1$data
@@ -37,11 +41,13 @@ test_that("ppc_error_scatter_avg same as ppc_error_scatter if nrow(yrep) = 1", {
3741
})
3842

3943
test_that("ppc_error_scatter_avg_vs_x returns ggplot2 object", {
44+
skip_if_not_installed("rstantools")
4045
expect_gg(ppc_error_scatter_avg_vs_x(y, yrep, x = rnorm(length(y))))
4146
expect_gg(ppc_error_scatter_avg_vs_x(y, yrep[1:5, ], x = rnorm(length(y))))
4247
})
4348

4449
test_that("ppc_error_binned returns ggplot object", {
50+
skip_if_not_installed("rstantools")
4551
load(test_path("data-for-binomial.rda"))
4652
expect_gg(ppc_error_binned(y, Ey))
4753
expect_gg(ppc_error_binned(y[1:5], Ey[, 1:5]))

0 commit comments

Comments
 (0)