From d17830759e7d989253409ea39bdeb49a18ae5503 Mon Sep 17 00:00:00 2001 From: Adam Black Date: Thu, 19 Aug 2021 00:04:51 -0400 Subject: [PATCH] download drivers before running tests --- DESCRIPTION | 3 ++- tests/setup.R | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 tests/setup.R diff --git a/DESCRIPTION b/DESCRIPTION index 6b81c97..28be57a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -21,7 +21,8 @@ Imports: Suggests: knitr, testthat (>= 3.0.0), - RSQLite + RSQLite, + withr NeedsCompilation: no RoxygenNote: 7.1.1 Config/testthat/edition: 3 diff --git a/tests/setup.R b/tests/setup.R new file mode 100644 index 0000000..5cc6b42 --- /dev/null +++ b/tests/setup.R @@ -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())