Skip to content

Commit

Permalink
Check for tibble package before using it on tests (#971)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
llrs-roche and github-actions[bot] authored Dec 12, 2024
1 parent abf055e commit 36185ca
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/testthat.R
Original file line number Diff line number Diff line change
@@ -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")
}
3 changes: 3 additions & 0 deletions tests/testthat/test-default_split_funs.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
3 changes: 3 additions & 0 deletions tests/testthat/test-lyt-tabulation.R
Original file line number Diff line number Diff line change
Expand Up @@ -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") %>%
Expand Down
3 changes: 3 additions & 0 deletions tests/testthat/test-printing.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
3 changes: 3 additions & 0 deletions tests/testthat/test-subset-access.R
Original file line number Diff line number Diff line change
Expand Up @@ -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") %>%
Expand Down

0 comments on commit 36185ca

Please sign in to comment.