Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for tibble package before using it on tests #971

Merged
merged 3 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading