Eunomia
Eunomia copied to clipboard
Eunomia 2.0 Unit Test Notes
Just making an issue here to note any changes made while attempting to update unit tests to use Eunomia 2.0 (currently on the develop
branch).
- Unit tests will need to set up the
EUNOMIA_DATA_FOLDER
environment variable so GitHub Actions (GHA) has a place to store the data. Here is some boiler plate code that could go into thetests/testthat/setup.R
file for reference:
dataFolder <- tempfile()
dir.create(dataFolder)
oldEunomiaFolder <- Sys.getenv("EUNOMIA_DATA_FOLDER")
Sys.setenv("EUNOMIA_DATA_FOLDER" = dataFolder)
withr::defer(
{
unlink(dataFolder)
Sys.setenv("EUNOMIA_DATA_FOLDER" = oldEunomiaFolder)
},
testthat::teardown_env()
)
-
Vignettes that use Eunomia will also need to set the
EUNOMIA_DATA_FOLDER
environment variable in order for the R CMD check to work properly on GHA. -
The signature of the function
Eunomia::getConnectionDetails()
has changed. v1.x supported the following signature:
getEunomiaConnectionDetails <- function(databaseFile = tempfile(fileext = ".sqlite"))
v2.x removes the databaseFile
parameter when calling Eunomia::getConnectionDetails()
. The control over the databaseFile
parameter is governed by the EUNOMIA_DATA_FOLDER
environment variable. Alternatively, you can make use of the Eunomia::getConnectionDetails
function for more fine-grained control over the dataset used, etc.