Running ‘testthat.R’ [139s/154s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(DrugUtilisation)
  > 
  > availableConnections <- list(list(
  +   con = DBI::dbConnect(duckdb::duckdb(), ":memory:"),
  +   writeSchema = "main",
  +   mockPrefix = NULL
  + ))
  > 
  > # if (Sys.getenv("CDM5_SQL_SERVER_USER") != "") {
  > #   availableConnections <- availableConnections %>%
  > #     append(value = list(list(
  > #       con = DBI::dbConnect(
  > #         odbc::odbc(),
  > #         Driver   = "ODBC Driver 18 for SQL Server",
  > #         Server   = Sys.getenv("CDM5_SQL_SERVER_SERVER"),
  > #         Database = Sys.getenv("CDM5_SQL_SERVER_CDM_DATABASE"),
  > #         UID      = Sys.getenv("CDM5_SQL_SERVER_USER"),
  > #         PWD      = Sys.getenv("CDM5_SQL_SERVER_PASSWORD"),
  > #         TrustServerCertificate = "yes",
  > #         Port     = 1433
  > #       ),
  > #       writeSchema = Sys.getenv("CDM5_SQL_SERVER_OHDSI_SCHEMA"),
  > #       mockPrefix = "test_dus_"
  > #     )))
  > # }
  > 
  > # if (Sys.getenv("CDM5_REDSHIFT_DBNAME") != "") {
  > #   availableConnections <- availableConnections %>%
  > #     append(value = list(list(
  > #       con = DBI::dbConnect(
  > #         RPostgres::Redshift(), dbname = Sys.getenv("CDM5_REDSHIFT_DBNAME"),
  > #         port = Sys.getenv("CDM5_REDSHIFT_PORT"),
  > #         host = Sys.getenv("CDM5_REDSHIFT_HOST"),
  > #         user = Sys.getenv("CDM5_REDSHIFT_USER"),
  > #         password = Sys.getenv("CDM5_REDSHIFT_PASSWORD")
  > #       ),
  > #       writeSchema = Sys.getenv("CDM5_REDSHIFT_SCRATCH_SCHEMA"),
  > #       mockPrefix = "test_dus_"
  > #     )))
  > # }
  > 
  > for (k in seq_along(availableConnections)) {
  +   # connection details
  +   connectionDetails <- availableConnections[[k]]
  +   # test code in that dbms
  +   test_check("DrugUtilisation")
  + }
  > measurement table not present in the cdm
  > procedure_occurrence table not present in the cdm
  > measurement table not present in the cdm
  > procedure_occurrence table not present in the cdm
  i This cdm contains non standard patterns please inform the mantainer of
  the package or open an issue in
  https://github.com/darwin-eu/DrugUtilisation so your new patterns could
  be supported
  [ FAIL 8 | WARN 0 | SKIP 14 | PASS 161 ]
  
  ══ Skipped tests (14) ══════════════════════════════════════════════════════════
  • On CRAN (14): 'test-dailyDose.R:2:3', 'test-drugUse.R:3:3',
    'test-drugUse.R:29:3', 'test-drugUse.R:237:3', 'test-drugUse.R:456:3',
    'test-drugUse.R:611:3', 'test-drugUse.R:862:3', 'test-drugUse.R:912:3',
    'test-drugUse.R:952:3', 'test-generateDrugUtilisationCohortSet.R:51:3',
    'test-generateDrugUtilisationCohortSet.R:188:3', 'test-indication.R:153:3',
    'test-indication.R:293:3', 'test-indication.R:413:3'
  
  ══ Failed tests ════════════════════════════════════════════════════════════════
  ── Failure ('test-generateConceptCohortSet.R:4:3'): test inputs ────────────────
  Expected `cdm <- generateConceptCohortSet(cdm, "indications_cohort", indications)` to run without any errors.
  i Actually got a <simpleError> with text:
    'addPriorHistory' is not an exported object from 'namespace:PatientProfiles'
  ── Error ('test-generateDrugUtilisationCohortSet.R:8:3'): test inputs ──────────
  Error: 'addPriorHistory' is not an exported object from 'namespace:PatientProfiles'
  Backtrace:
      ▆
   1. ├─DrugUtilisation::generateDrugUtilisationCohortSet(...) at test-generateDrugUtilisationCohortSet.R:8:2
   2. │ └─DrugUtilisation:::requireDaysPriorHistory(cohort, cdm, daysPriorHistory)
   3. │   └─... %>% computeTable(cdm)
   4. ├─DrugUtilisation:::computeTable(., cdm)
   5. │ └─x %>% ...
   6. ├─CDMConnector::computeQuery(...)
   7. ├─dplyr::select(., -"prior_history")
   8. └─dplyr::filter(., .data$prior_history >= .env$daysPriorHistory)
  ── Failure ('test-indication.R:68:3'): test case single indication ─────────────
  ... == "Asthma" is not TRUE
  
  `actual`:   FALSE
  `expected`: TRUE 
  ── Failure ('test-indication.R:94:3'): test case single indication ─────────────
  ... == "Asthma" is not TRUE
  
  `actual`:   FALSE
  `expected`: TRUE 
  ── Failure ('test-indication.R:121:3'): test case single indication ────────────
  identical(...) is not TRUE
  
  `actual`:   FALSE
  `expected`: TRUE 
  ── Failure ('test-indication.R:143:3'): test case single indication ────────────
  identical(...) is not TRUE
  
  `actual`:   FALSE
  `expected`: TRUE 
  ── Failure ('test-tableOne.R:47:3'): test indicationDate ───────────────────────
  Expected `... <- NULL` to run without any errors.
  i Actually got a <rlang_error> with text:
    variables should be a unique named list that point to columns in table
  ── Error ('test-tableOne.R:52:3'): test indicationDate ─────────────────────────
  Error in `eval(code, test_env)`: object 'result' not found
  Backtrace:
      ▆
   1. ├─testthat::expect_identical(...) at test-tableOne.R:52:2
   2. │ └─testthat::quasi_label(enquo(object), label, arg = "object")
   3. │   └─rlang::eval_bare(expr, quo_get_env(quo))
   4. ├─... %>% as.numeric()
   5. ├─dplyr::pull(., "estimate")
   6. ├─dplyr::filter(., estimate_type == "count")
   7. ├─dplyr::filter(., variable == "covid_minf_to_0")
   8. └─dplyr::filter(., group_level == "exposed")
  
  [ FAIL 8 | WARN 0 | SKIP 14 | PASS 161 ]
  Error: Test failures
  Execution halted
  Warning messages:
  1: Connection is garbage-collected, use dbDisconnect() to avoid this. 
  2: Database is garbage-collected, use dbDisconnect(con, shutdown=TRUE) or duckdb::duckdb_shutdown(drv) to avoid this.