Skip to content

Commit 0ea2892

Browse files
committed
skip tests that use non-installed/imported packaged
1 parent a76100d commit 0ea2892

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

tests/testthat/test-ggplot-contour.R

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
context("Contour")
22

3-
volcano3d <- reshape2::melt(volcano)
4-
names(volcano3d) <- c("x", "y", "z")
5-
# Draw a contour plot using geom_contour
6-
gg <- ggplot(volcano3d) + geom_contour(aes(x=x, y=y, z=z))
7-
L <- save_outputs(gg, "contour")
3+
84

95
test_that("geom_contour is translated to a path", {
6+
skip_if_not_installed("reshape2")
7+
8+
volcano3d <- reshape2::melt(volcano)
9+
names(volcano3d) <- c("x", "y", "z")
10+
# Draw a contour plot using geom_contour
11+
gg <- ggplot(volcano3d) + geom_contour(aes(x=x, y=y, z=z))
12+
L <- save_outputs(gg, "contour")
1013
expect_equivalent(length(L$data), 1)
1114
expect_identical(L$data[[1]]$type, "scatter")
1215
expect_identical(L$data[[1]]$mode, "lines")

tests/testthat/test-ggplot-heatmap.R

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@ workweek <- matrix(
77
nrow = 5, ncol = 3, byrow = TRUE,
88
dimnames = list(day = wdays, time = dtimes)
99
)
10-
ww <- reshape2::melt(workweek)
11-
ww$day <- factor(ww$day, wdays)
12-
ww$time <- factor(ww$time, dtimes)
13-
# Plot a heatmap using geom_tile
14-
hm <- ggplot(ww) + geom_tile(aes(x = day, y = time, fill = value))
1510

1611
test_that("geom_tile is translated to type=heatmap", {
12+
skip_if_not_installed("reshape2")
13+
14+
ww <- reshape2::melt(workweek)
15+
ww$day <- factor(ww$day, wdays)
16+
ww$time <- factor(ww$time, dtimes)
17+
# Plot a heatmap using geom_tile
18+
hm <- ggplot(ww) + geom_tile(aes(x = day, y = time, fill = value))
19+
1720
L <- save_outputs(hm, "heatmap")
1821
# one trace is for the colorbar
1922
expect_equivalent(length(L$data), 2)

tests/testthat/test-ggplot-ticks.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ test_that("The breaks can be spaced unevenly", {
175175
})
176176

177177
test_that("R line breaks are translated to HTML line breaks", {
178+
skip_if_not_installed("stringr")
179+
178180
df_x <- data.frame(
179181
x = "this is very loooooooooooong text to illustrate",
180182
y = 100

0 commit comments

Comments
 (0)