Skip to content

Commit

Permalink
Disabling SQLite from unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
schuemie committed Jun 18, 2024
1 parent 2970211 commit abe8ae2
Showing 1 changed file with 46 additions and 46 deletions.
92 changes: 46 additions & 46 deletions tests/testthat/setup.R
Original file line number Diff line number Diff line change
Expand Up @@ -172,52 +172,52 @@ if (.Platform$OS.type == "windows") {
}

# SQLite
sqliteFile <- tempfile(fileext = ".sqlite")
if (testthat::is_testing()) {
withr::defer(unlink(sqliteFile, force = TRUE), testthat::teardown_env())
}
cdmDatabaseSchema <- "main"
connectionDetails <- createConnectionDetails(
dbms = "sqlite",
server = sqliteFile
)
connection <- connect(connectionDetails)
insertTable(
connection = connection,
databaseSchema = cdmDatabaseSchema,
tableName = "person",
data = data.frame(person_id = seq_len(100),
year_of_birth = round(runif(100, 1900, 2000)),
race_concept_id = as.numeric(NA),
gender_concept_id = rep(c(8507, 8532), 50),
care_site_id = round(runif(100, 1, 1e7)))
)
insertTable(
connection = connection,
databaseSchema = cdmDatabaseSchema,
tableName = "observation_period",
data = data.frame(person_id = seq_len(100),
observation_period_start_date = rep(as.Date("2000-01-01"), 100),
observation_period_end_date = rep(as.Date(c("2000-06-01", "2001-12-31")), 50),
period_type_concept_id = rep(0, 100))
)
insertTable(
connection = connection,
databaseSchema = cdmDatabaseSchema,
tableName = "vocabulary",
data = data.frame(vocabulary_id = c("a", "b"),
vocabulary_name = c("a", "b"),
vocabulary_reference= c("a", "b"),
vocabulary_version = c("a", "b"),
vocabulary_concpet_id = c(1, 2))
)
disconnect(connection)
testServers[[length(testServers) + 1]] <- list(
connectionDetails = connectionDetails,
NULL,
cdmDatabaseSchema = cdmDatabaseSchema,
tempEmulationSchema = NULL
)
# sqliteFile <- tempfile(fileext = ".sqlite")
# if (testthat::is_testing()) {
# withr::defer(unlink(sqliteFile, force = TRUE), testthat::teardown_env())
# }
# cdmDatabaseSchema <- "main"
# connectionDetails <- createConnectionDetails(
# dbms = "sqlite",
# server = sqliteFile
# )
# connection <- connect(connectionDetails)
# insertTable(
# connection = connection,
# databaseSchema = cdmDatabaseSchema,
# tableName = "person",
# data = data.frame(person_id = seq_len(100),
# year_of_birth = round(runif(100, 1900, 2000)),
# race_concept_id = as.numeric(NA),
# gender_concept_id = rep(c(8507, 8532), 50),
# care_site_id = round(runif(100, 1, 1e7)))
# )
# insertTable(
# connection = connection,
# databaseSchema = cdmDatabaseSchema,
# tableName = "observation_period",
# data = data.frame(person_id = seq_len(100),
# observation_period_start_date = rep(as.Date("2000-01-01"), 100),
# observation_period_end_date = rep(as.Date(c("2000-06-01", "2001-12-31")), 50),
# period_type_concept_id = rep(0, 100))
# )
# insertTable(
# connection = connection,
# databaseSchema = cdmDatabaseSchema,
# tableName = "vocabulary",
# data = data.frame(vocabulary_id = c("a", "b"),
# vocabulary_name = c("a", "b"),
# vocabulary_reference= c("a", "b"),
# vocabulary_version = c("a", "b"),
# vocabulary_concpet_id = c(1, 2))
# )
# disconnect(connection)
# testServers[[length(testServers) + 1]] <- list(
# connectionDetails = connectionDetails,
# NULL,
# cdmDatabaseSchema = cdmDatabaseSchema,
# tempEmulationSchema = NULL
# )

# DuckDB
# duckdbFile <- tempfile(fileext = ".duckdb")
Expand Down

0 comments on commit abe8ae2

Please sign in to comment.