Running ‘testthat.R’ [155s/88s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > # This file is part of the standard setup for testthat.
  > # It is recommended that you do not modify it.
  > #
  > # Where should you do additional test configuration?
  > # Learn more about the roles of various files in:
  > # * https://r-pkgs.org/tests.html
  > # * https://testthat.r-lib.org/reference/test_package.html#special-files
  > 
  > library(testthat)
  > library(DrugUtilisation)
  > 
  > test_check("DrugUtilisation")
  Starting 2 test processes
  [ FAIL 8 | WARN 77 | SKIP 18 | PASS 18 ]
  
  ══ Skipped tests (18) ══════════════════════════════════════════════════════════
  • On CRAN (18): 'test-dailyDose.R:2:3', 'test-drugUse.R:2:3',
    'test-drugUse.R:40:3', 'test-drugUse.R:244:3', 'test-drugUse.R:430:3',
    'test-drugUse.R:557:3', 'test-drugUse.R:809:3', 'test-drugUse.R:857:3',
    'test-drugUse.R:897:3', 'test-indication.R:3:3', 'test-indication.R:182:3',
    'test-indication.R:333:3', 'test-indication.R:443:3',
    'test-generateDrugUtilisationCohortSet.R:48:3',
    'test-generateDrugUtilisationCohortSet.R:147:3',
    'test-generateDrugUtilisationCohortSet.R:203:3',
    'test-generateDrugUtilisationCohortSet.R:253:3',
    'test-generateDrugUtilisationCohortSet.R:351:3'
  
  ══ Failed tests ════════════════════════════════════════════════════════════════
  ── Error ('test-drugUse.R:956:5'): check all estimates ─────────────────────────
  Error in `UseMethod("settings")`: no applicable method for 'settings' applied to an object of class "c('GeneratedCohortSet', 'cdm_table', 'tbl_duckdb_connection', 'tbl_dbi', 'tbl_sql', 'tbl_lazy', 'tbl')"
  Backtrace:
       ▆
    1. ├─... %>% dplyr::filter(.data$group_name == "cohort_name") at test-drugUse.R:956:5
    2. ├─dplyr::filter(., .data$group_name == "cohort_name")
    3. ├─DrugUtilisation::summariseDrugUse(...)
    4. │ └─cohort %>% PatientProfiles::addCohortName() %>% dplyr::collect()
    5. ├─dplyr::collect(.)
    6. ├─PatientProfiles::addCohortName(.)
    7. │ └─cohort %>% ...
    8. ├─dplyr::left_join(...)
    9. ├─omopgenerics:::left_join.cdm_table(...)
   10. │ ├─dplyr::left_join(x, ...)
   11. │ └─dbplyr:::left_join.tbl_lazy(x, ...)
   12. │   └─dbplyr:::add_join(...)
   13. │     └─dplyr::tbl_vars(y)
   14. │       ├─dplyr:::new_sel_vars(tbl_vars_dispatch(x), group_vars(x))
   15. │       │ └─base::structure(...)
   16. │       └─dplyr:::tbl_vars_dispatch(x)
   17. ├─omopgenerics::settings(cohort) %>% ...
   18. ├─dplyr::select(., "cohort_definition_id", "cohort_name")
   19. └─omopgenerics::settings(cohort)
  ── Error ('test-drugUse.R:983:3'): check all variables ─────────────────────────
  Error in `newOmopTable(value)`: valid_start_date and valid_end_date are not present in table concept_relationship
  Backtrace:
      ▆
   1. └─DrugUtilisation::mockDrugUtilisation(...) at test-drugUse.R:983:3
   2.   ├─base::`[[<-`(`*tmp*`, newTable, value = `<tbl_dck_[,3]>`)
   3.   └─omopgenerics:::`[[<-.cdm_reference`(`*tmp*`, newTable, value = `<tbl_dck_[,3]>`)
   4.     └─omopgenerics::newOmopTable(value)
   5.       └─omopgenerics:::checkColumnsCdm(table, name, cols)
   6.         └─cli::cli_abort(...)
   7.           └─rlang::abort(...)
  ── Error ('test-drugUse.R:1018:3'): test impute duration percentage ────────────
  Error: 'addAttributes' is not an exported object from 'namespace:PatientProfiles'
  Backtrace:
      ▆
   1. └─DrugUtilisation::generateDrugUtilisationCohortSet(...) at test-drugUse.R:1018:3
   2.   └─DrugUtilisation:::unionCohort(cohort, gapEra, cdm)
  ── Error ('test-indication.R:531:3'): summariseIndication ──────────────────────
  Error in `validateGeneratedCohortSet(cohort, soft = .softValidation)`: 3 observations outside observation period.
  Backtrace:
      ▆
   1. └─DrugUtilisation::mockDrugUtilisation(...) at test-indication.R:531:3
   2.   └─CDMConnector::cdm_from_con(...)
   3.     └─omopgenerics::newCohortTable(...)
   4.       └─omopgenerics:::validateGeneratedCohortSet(cohort, soft = .softValidation)
   5.         └─omopgenerics:::checkObservationPeriod(cohort)
   6.           └─cli::cli_abort(...)
   7.             └─rlang::abort(...)
  ── Failure ('test-generateDrugUtilisationCohortSet.R:7:3'): test inputs ────────
  Expected `generateDrugUtilisationCohortSet(cdm, "dus", list(acetaminophen = 1))` to run without any errors.
  i Actually got a <simpleError> with text:
    Assertion on 'name' failed: Contains missing values (element 1).
  ── Error ('test-generateDrugUtilisationCohortSet.R:8:3'): test inputs ──────────
  Error: 'addAttributes' is not an exported object from 'namespace:PatientProfiles'
  Backtrace:
      ▆
   1. └─DrugUtilisation::generateDrugUtilisationCohortSet(...) at test-generateDrugUtilisationCohortSet.R:8:3
   2.   └─DrugUtilisation:::unionCohort(cohort, gapEra, cdm)
  ── Error ('test-generateDrugUtilisationCohortSet.R:398:3'): test impute duration methods ──
  Error in `insertTable.db_cdm(cdm = getTableSource(table), name = name, 
      table = cohortSetRef, overwrite = TRUE)`: Assertion on 'name' failed: Contains missing values (element 1).
  Backtrace:
       ▆
    1. └─DrugUtilisation::generateDrugUtilisationCohortSet(...) at test-generateDrugUtilisationCohortSet.R:398:3
    2.   └─CDMConnector::newGeneratedCohortSet(...)
    3.     └─CDMConnector::new_generated_cohort_set(...)
    4.       └─omopgenerics::newCohortTable(...)
    5.         └─omopgenerics:::populateCohortSet(table, cohortSetRef)
    6.           ├─omopgenerics::insertTable(...)
    7.           └─CDMConnector:::insertTable.db_cdm(...)
    8.             └─checkmate::assertCharacter(name, len = 1, any.missing = FALSE)
    9.               └─checkmate::makeAssertion(x, res, .var.name, add)
   10.                 └─checkmate:::mstop(...)
  ── Error ('test-patterns.R:30:2'): create patterns, correct output ─────────────
  Error in `newOmopTable(value)`: valid_start_date and valid_end_date are not present in table concept_relationship
  Backtrace:
      ▆
   1. └─DrugUtilisation::mockDrugUtilisation(...) at test-patterns.R:30:2
   2.   ├─base::`[[<-`(`*tmp*`, newTable, value = `<tbl_dck_[,3]>`)
   3.   └─omopgenerics:::`[[<-.cdm_reference`(`*tmp*`, newTable, value = `<tbl_dck_[,3]>`)
   4.     └─omopgenerics::newOmopTable(value)
   5.       └─omopgenerics:::checkColumnsCdm(table, name, cols)
   6.         └─cli::cli_abort(...)
   7.           └─rlang::abort(...)
  
  [ FAIL 8 | WARN 77 | SKIP 18 | PASS 18 ]
  Error: Test failures
  Execution halted