Skip to content

Commit

Permalink
Merge pull request #251 from oxford-pharmacoepi/skip_tests
Browse files Browse the repository at this point in the history
skip_on_cran
  • Loading branch information
xihang-chen authored May 30, 2024
2 parents 9e5089b + 2f1ac4a commit 8d9664f
Show file tree
Hide file tree
Showing 10 changed files with 145 additions and 108 deletions.
4 changes: 2 additions & 2 deletions man/CohortSymmetry-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 15 additions & 7 deletions tests/testthat/test-attrition.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
test_that("attrition: output structure", {
skip_on_cran()
indexCohort <- dplyr::tibble(
cohort_definition_id = c(1, 1, 1, 1, 1, 2, 2, 2, 2, 2),
subject_id = c(1, 4, 2, 3, 5, 5, 4, 3, 6, 1),
Expand Down Expand Up @@ -55,6 +56,7 @@ test_that("attrition: output structure", {
})

test_that("attrition: cohortDateRange", {
skip_on_cran()
indexCohort <- dplyr::tibble(
cohort_definition_id = c(1, 1, 1, 1, 1, 2, 2, 2, 2, 2),
subject_id = c(1, 4, 2, 3, 5, 5, 4, 3, 6, 1),
Expand Down Expand Up @@ -103,13 +105,13 @@ test_that("attrition: cohortDateRange", {
dplyr::select(number_records) == 5))

cdm <- generateSequenceCohortSet(cdm = cdm,
name = "joined_cohorts",
indexTable = "cohort_1",
indexId = 1,
markerTable = "cohort_2",
markerId = 3,
cohortDateRange=as.Date(c("2019-12-01", "2022-12-31")),
combinationWindow = c(0, Inf))
name = "joined_cohorts",
indexTable = "cohort_1",
indexId = 1,
markerTable = "cohort_2",
markerId = 3,
cohortDateRange=as.Date(c("2019-12-01", "2022-12-31")),
combinationWindow = c(0, Inf))

expect_true(all(c(
"cohort_definition_id", "number_records", "number_subjects",
Expand All @@ -136,6 +138,7 @@ test_that("attrition: cohortDateRange", {
})

test_that("attrition: combinationWindow", {
skip_on_cran()
indexCohort <- dplyr::tibble(
cohort_definition_id = c(1, 1, 1, 1, 1, 2, 2, 2, 2, 2),
subject_id = c(1, 4, 2, 3, 5, 5, 4, 3, 6, 1),
Expand Down Expand Up @@ -281,6 +284,7 @@ test_that("attrition: combinationWindow", {
})

test_that("attrition: indexMarkerGap", {
skip_on_cran()
indexCohort <- dplyr::tibble(
cohort_definition_id = c(1, 1, 1, 1, 1, 2, 2, 2, 2, 2),
subject_id = c(1, 4, 2, 3, 5, 5, 4, 3, 6, 1),
Expand Down Expand Up @@ -359,6 +363,7 @@ test_that("attrition: indexMarkerGap", {
})

test_that("attrition: daysPriorObservation", {
skip_on_cran()
indexCohort <- dplyr::tibble(
cohort_definition_id = c(1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 1),
subject_id = c(1, 3, 4, 2, 5, 1, 2, 3, 4, 5, 1),
Expand Down Expand Up @@ -418,6 +423,7 @@ test_that("attrition: daysPriorObservation", {
})

test_that("attrition: washoutWindow", {
skip_on_cran()
indexCohort <- dplyr::tibble(
cohort_definition_id = c(1, 1, 1, 1, 1, 2, 2, 2, 2, 2),
subject_id = c(1, 1, 1, 2, 2, 1, 1, 1, 2, 2),
Expand Down Expand Up @@ -544,6 +550,7 @@ test_that("attrition: washoutWindow", {
})

test_that("attrition: complete example 1", {
skip_on_cran()
indexCohort <- dplyr::tibble(
cohort_definition_id = rep(1, 20),
subject_id = rep(c(1:4),5),
Expand Down Expand Up @@ -716,6 +723,7 @@ test_that("attrition: complete example 1", {
})

test_that("attrition: complete example 2", {
skip_on_cran()
indexCohort <- dplyr::tibble(
cohort_definition_id = rep(1, 20),
subject_id = rep(c(1:4),5),
Expand Down
3 changes: 3 additions & 0 deletions tests/testthat/test-displayTable.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ test_that("tableSequenceRatios - gt output", {
})

test_that("tableSequenceRatios - tibble output", {
skip_on_cran()
cdm <- mockCohortSymmetry()
cdm <- generateSequenceCohortSet(cdm = cdm,
indexTable = "cohort_1",
Expand All @@ -50,6 +51,7 @@ test_that("tableSequenceRatios - tibble output", {
})

test_that("tableSequenceRatios - flextable output", {
skip_on_cran()
cdm <- mockCohortSymmetry()
cdm <- generateSequenceCohortSet(cdm = cdm,
indexTable = "cohort_1",
Expand All @@ -75,6 +77,7 @@ test_that("tableSequenceRatios - flextable output", {
})

test_that("tableSequenceRatio options", {
skip_on_cran()
cdm <- mockCohortSymmetry()
cdm <- generateSequenceCohortSet(cdm = cdm,
indexTable = "cohort_1",
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-eunomia.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
test_that("eunomia - generateSequenceCohortSet", {
skip_on_cran()

if (Sys.getenv("EUNOMIA_DATA_FOLDER") == "") {
Sys.setenv("EUNOMIA_DATA_FOLDER" = tempdir())
Expand Down
Loading

0 comments on commit 8d9664f

Please sign in to comment.