Skip to content

Commit

Permalink
minor test fixes, NEWS, dev link borked
Browse files Browse the repository at this point in the history
  • Loading branch information
dsweber2 committed Jun 19, 2024
1 parent 626c30b commit a3c1403
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Open a release issue and then copy and follow this checklist in the issue (modif

- [ ] `git pull` on `dev` branch.
- [ ] Make sure all changes are committed and pushed.
- [ ] Check [current CRAN check results](https://cran.rstudio.org/web/checks/check_results_epiprocess.html).
- [ ] Check [current CRAN check results](https://cran.rstudio.org/web/checks/check_results_epidatr.html).
- [ ] `devtools::check(".", manual = TRUE, env_vars = c(NOT_CRAN = "false"))`.
- Aim for 10/10, no notes.
- [ ] If check works well enough, merge to main. Otherwise open a PR to fix up.
Expand Down
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
- Improve handling of the `EPIDATR_USE_CACHE` environment variable, allowing it
to be any value convertable by `as.logical()` and handle the case when it
can't be converted.
- Support more date formats in function to convert dates to epiweeks. Use `parse_api_date` since it already supports both common formats. #276
- `EPIDATR_USE_CACHE` only supported exactly "TRUE" before. Now it supports all logical values and includes a warning when any value that can't be converted to logical is provided. #273
- `missing` doesn't count default values as non-missing. If a user doesn't pass `geo_values` or `time_values` (both of which default to `"*"` in `pub_covidcast`), or `dates` (in `pub_covid_hosp_state_timeseries`), the missing check fails. To avoid this, just don't check missingness of those two arguments.

# epidatr 1.1.1

Expand Down
12 changes: 6 additions & 6 deletions tests/testthat/test-cache.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ test_set_cache <- function(cache_dir = new_temp_dir,
}

test_that("cache set as expected", {
test_set_cache()
expect_message(test_set_cache())
if (grepl("/", as.character(new_temp_dir))) {
# this is what check produces
expect_equal(cache_info()$dir, normalizePath(new_temp_dir))
Expand All @@ -38,7 +38,7 @@ test_that("cache set as expected", {

# use an existing example to save, then load and compare the values
test_that("cache saves & loads", {
test_set_cache()
expect_message(test_set_cache())
epidata_call <- pub_covidcast(
source = "jhu-csse",
signals = "confirmed_7dav_incidence_prop",
Expand Down Expand Up @@ -128,7 +128,7 @@ test_that("check_is_cachable", {
expect_false(check_is_cachable(epidata_call, fetch_args))
}
}
test_set_cache()
expect_message(test_set_cache())
check_fun(expected_result = FALSE) # doesn't specify issues or as_of
check_fun(as_of = "2020-01-01", expected_result = TRUE) # valid as_of
check_fun(issues = "2020-01-01", expected_result = TRUE) # valid issues
Expand Down Expand Up @@ -178,14 +178,14 @@ test_that("check_is_cachable", {
# cases where the cache isn't active
disable_cache()
check_fun(as_of = "2020-01-01", expected_result = FALSE)
test_set_cache()
expect_message(test_set_cache())
cache_environ$epidatr_cache <- NULL
check_fun(as_of = "2020-01-01", expected_result = FALSE)
test_set_cache()
expect_message(test_set_cache())
check_fun(as_of = "2020-01-01", expected_result = TRUE)
})

test_set_cache()
expect_message(test_set_cache())
cache_environ$epidatr_cache$prune()
clear_cache(disable = TRUE)
rm(new_temp_dir)
Expand Down

0 comments on commit a3c1403

Please sign in to comment.