Closed boshek closed 3 years ago
@ateucher any thoughts on how to test to see if one can change an option if it is set by package load?
I tried this: https://github.com/bcgov/bcdata/blob/919333c705d7b2ab102475f1f6fd7bacf68b56fe/tests/testthat/test-options.R#L37-L41
But that doesn't seem to stick.
Sorry, I didn't look closely enough at your approach...
What if we did this:
.onLoad
, we set ._bcdata_env$bcdata_dl_limit <- bcdc_single_download_limit()
getOption("bcdata.single_download_limit", default = ._bcdata_env$bcdata_dl_limit)
This allows a user to set the option, but if they don't we have a safe default - and someone couldn't inadvertently unset it (e.g., with options(bcdata.single_download_limit = NULL)
, which would leave everything in a broken state.
This would also allow us to check a user's set option against the catalogue's hard cap and throw an error if it's higher...
This PR:
bcdc_single_download_limit
functionNot yet implemented: ~- A test that makes sure one can reset that option.~