Closed hadley closed 1 year ago
Oops. This has been on my neglected list for a whiiile, thank you for the fixes! I know about the draftpicks issue.
@hadley when did you plan on having purrr submitted to CRAN?
I've also included a partial fix for dev purrr — but I can't quite figure out what the code is doing, so you'll need to figure it out yourself. The root cause is a bug in CRAN purrr where map_depth()
would happily map if an object at that depth didn't exist, even though it was supposed to error.
The purrr release isn't currently scheduled, but I'm likely to aim for mid-December.
@hadley trying to work on the vec_depth issue and noticed I'm also getting test failures related to tidyverse/purrr#976. Will ignore since issue is already raised (unless you've advice otherwise?)
✖ | 1 0 | ff_transactions [0.6s]
────────────────────────────────────────────────────────────────────
Error (test-ff_transactions.R:14:3): ff_transactions returns a tibble of transactions
Error in `map(.x, .f, ...)`: ℹ In index: 1.
Caused by error in `dplyr::mutate()`:
! Problem while computing `franchise_id =
purrr::map_chr(.data$franchise_id, unlist)`.
Caused by error in `purrr::map_chr()`:
ℹ In index: 1.
Caused by error in `deprecate_to_char()`:
! could not find function "deprecate_to_char"
Backtrace:
1. ffscrapr::ff_transactions(jml_conn, week = 1:9)
at test-ff_transactions.R:14:2
34. dplyr (local) `<fn>`(`<rlng_rrr>`)
edit: nvm I see this will be resolved by tidyverse/purrr#989
While you wait for a fix to trigger the proper deprecation message, you can call as.character()
to fix the underlying problem.
Looks like this vec_depth()
issue is a holdover from when I was trying to unnest a ragged list-column (#344). Seems like purrr::map(dplyr::bind_rows)
will work without the ragged extraction, so I think it does the trick.
Thoughts on your other changes (in case you were curious):
I now cache the httptest shims for 24 hours to avoid downloading them every time the tests are run. This probably isn't quite right (I don't know why they are in a separate repo to begin with) and will need a bit more work for CRAN (since I think you'll need to clean up the cache directory in R CMD check)
Mocked API data was previously bundled inside of the package tests, but was quite large and caused the built package to grow larger than 10MB. I didn't know about the existence of piggyback
at the time or I would have used that and attached the test data to a GH release of this repository. I still might switch this over a bit later.
I replaced with_mock_api() with local_mock_api() so the test back traces are simpler (and clicking on them in RStudio takes you to the right place) I switched from setup.R to helper-mocking.R so it all works when you use load_all()
These all look good to me. I added back a check to see if GitHub was online, because at one point I got BDR'ed for GitHub being offline when it was trying to download mock data and GH was not online 😦
Thank you for taking the time to work on this, and for making purrr and the tidyverse awesome!
Why not just leave the test data in the same repo, but .Rbuildignore
d? IMO you really shouldn't be downloading these files during CRAN tests.
I think that would require skip_on_cran, which would have prevented the purrr revdepcheck from identifying this problem altogether - and I wanted to be robust against dependency changes
Avoiding the package size limitation by downloading a file during testing feels a bit dubious to me. If CRAN hasn't complained specifically about it, you're probably ok, but I'd be prepared to rework it if they do notice and don't like it.
FYI purrr is now scheduled for release to CRAN on Dec 19
This was supposed to be a minimal patch to fix a failure with dev purrr, but I got a bit distracted by the challenge of running individual tests interactive, so made a couple of changes:
R CMD check
)with_mock_api()
withlocal_mock_api()
so the test back traces are simpler (and clicking on them in RStudio takes you to the right place)setup.R
tohelper-mocking.R
so it all works when you useload_all()
With that done, I still see two failing tests:
I don't see how this could ever have worked since
current_picks
isn't defined (as far as I can tell) in the necessary scope: https://github.com/hadley/ffscrapr/blob/dev-purrr/R/sleeper_draftpicks.R#L36I guess this should be mocked, but is not?