tidyverse / googledrive

Google Drive R API
https://googledrive.tidyverse.org/
Other
322 stars 47 forks source link

Optionally skip tests requiring 'mockr' #434

Open MichaelChirico opened 1 year ago

MichaelChirico commented 1 year ago

It would be simpler to add the skip() inside the helper:

https://github.com/tidyverse/googledrive/blob/b87d89ec5368e7c9800978ae2a8af71a34a20b54/tests/testthat/helper.R#L16-L18

But the tests would have to be rewritten a bit, e.g.

https://github.com/tidyverse/googledrive/blob/b87d89ec5368e7c9800978ae2a8af71a34a20b54/tests/testthat/test-drive_get_path.R#L68-L74

Would probably become:

with_mock(
  root_id = function() "",
  expect_equal(resolve_paths(as_dribble(x), ancestors)$path, "e")
)

That format of test looks more natural to me anyway, but filing as is now pending feedback.

jennybc commented 1 year ago

I've been removing mockr dependencies in favor of testthat::local_mocked_bindings(). Apparently I just haven't done so here yet. So I'm not going to take a change that touches this stuff in any other way; it's not worth fiddling with it.

MichaelChirico commented 1 year ago

Makes sense! I'll leave this open for now in case it serves as a reminder, but feel free to close at any time.