download drivers before running tests

This commit is contained in:
Adam Black 2021-08-19 00:04:51 -04:00
parent a6366dff4a
commit d17830759e
2 changed files with 14 additions and 1 deletions

View File

@ -21,7 +21,8 @@ Imports:
Suggests: Suggests:
knitr, knitr,
testthat (>= 3.0.0), testthat (>= 3.0.0),
RSQLite RSQLite,
withr
NeedsCompilation: no NeedsCompilation: no
RoxygenNote: 7.1.1 RoxygenNote: 7.1.1
Config/testthat/edition: 3 Config/testthat/edition: 3

12
tests/setup.R Normal file
View File

@ -0,0 +1,12 @@
# Download the JDBC drivers used in the tests
oldJarFolder <- Sys.getenv("DATABASECONNECTOR_JAR_FOLDER")
Sys.setenv("DATABASECONNECTOR_JAR_FOLDER" = tempfile("jdbcDrivers"))
downloadJdbcDrivers("postgresql")
# downloadJdbcDrivers("sql server")
# downloadJdbcDrivers("oracle")
withr::defer({
unlink(Sys.getenv("DATABASECONNECTOR_JAR_FOLDER"), recursive = TRUE, force = TRUE)
Sys.setenv("DATABASECONNECTOR_JAR_FOLDER" = oldJarFolder)
}, testthat::teardown_env())