diff --git a/tests/testthat.R b/tests/testthat.R index 889790f0b..b4b1f6613 100644 --- a/tests/testthat.R +++ b/tests/testthat.R @@ -1,2 +1,5 @@ -library(testthat) -test_check("rtables", reporter = "check") +if (requireNamespace("testthat", quietly = TRUE)) { + library(testthat) + library(rtables) + test_check("rtables", reporter = "check") +} diff --git a/tests/testthat/test-default_split_funs.R b/tests/testthat/test-default_split_funs.R index d4c31703d..168ba34ba 100644 --- a/tests/testthat/test-default_split_funs.R +++ b/tests/testthat/test-default_split_funs.R @@ -249,6 +249,9 @@ test_that("drop_and_remove_levels also works with character variables", { }) test_that("trim_levels_to_map split function works", { + skip_if_not_installed("tibble") + require(tibble, quietly = TRUE) + map <- data.frame( LBCAT = c("CHEMISTRY", "CHEMISTRY", "CHEMISTRY", "IMMUNOLOGY"), PARAMCD = c("ALT", "CRP", "CRP", "IGA"), diff --git a/tests/testthat/test-lyt-tabulation.R b/tests/testthat/test-lyt-tabulation.R index 578638e99..154ec2eca 100644 --- a/tests/testthat/test-lyt-tabulation.R +++ b/tests/testthat/test-lyt-tabulation.R @@ -237,6 +237,9 @@ test_that("labelkids parameter works", { test_that("ref_group comparisons work", { + skip_if_not_installed("tibble") + require(tibble, quietly = TRUE) + blthing <- basic_table() %>% split_cols_by("ARM", ref_group = "ARM1") %>% analyze("AGE", show_labels = "hidden") %>% diff --git a/tests/testthat/test-printing.R b/tests/testthat/test-printing.R index 74b4ca3b5..148f8f250 100644 --- a/tests/testthat/test-printing.R +++ b/tests/testthat/test-printing.R @@ -801,6 +801,9 @@ test_that("horizontal separator is propagated from table to print and export", { ## higher-level showing ncols works: test_that("showing higher-level ncols works", { + skip_if_not_installed("tibble") + require(tibble, quietly = TRUE) + mydat <- subset(ex_adsl, SEX %in% c("M", "F")) mydat$SEX2 <- factor( ifelse( diff --git a/tests/testthat/test-subset-access.R b/tests/testthat/test-subset-access.R index c56f297eb..f136dc6ef 100644 --- a/tests/testthat/test-subset-access.R +++ b/tests/testthat/test-subset-access.R @@ -136,6 +136,9 @@ test_rowpaths <- function(tt, visonly = TRUE) { test_that("make_row_df, make_col_df give paths which all work", { + skip_if_not_installed("tibble") + require(tibble, quietly = TRUE) + lyt <- basic_table() %>% split_cols_by("ARM") %>% split_cols_by("SEX", ref_group = "F") %>%