DominikRafacz / deepdep

Visualise and Explore Deep Dependencies of R packages
https://dominikrafacz.github.io/deepdep/
GNU General Public License v3.0
73 stars 8 forks source link

Allow tests to run when vcr is not installed #26

Closed eddelbuettel closed 2 years ago

eddelbuettel commented 2 years ago

This is a slightly more 'risky' PR in the sense that I am not a regular user of testthat and certainly not of vcr which i don't even have installed -- so I cannot run R CMD check here for deepdep which is mildly irritating. And, if we look closely at Writing R Extensions, incorrect. Suggested packaged should be used conditionally only.

This PR does that with minimal changes to the test files. But again, from someone not using testthat so not sure if I broke some of the (many) (opinionated) rules here. But it now tests for me, and is one step forward.

Feel free to nudge and adjust by pushing to this branch, or close it if you wildly disagree. The 'test only with Suggests: installed' issue does warrant some attention though (even if CRAN does not (yet?) enforce it it is slowly getting more attention).

ErdaradunGaztea commented 2 years ago

One thing I'd definitely want from the solution is to mark omitted test cases as "skipped". However, this would require changing the relative positions of vcr::use_cassette() and test_that(), and I'm not yet sure how possible is that (hopefully there'll be no problems). I'll play with that in a moment.

eddelbuettel commented 2 years ago

Yes, I certainly have seen the skip_if_not_installed() predicate in use for that, but only inside a testthat block. Maybe you can shuffle the logic around to make that work. Maybe a simpler out testhat block also around the 'tape restore' part is all it takes.

ErdaradunGaztea commented 2 years ago

In fact, even HTTP testing in R includes vcr inside test_that: image

If the checks pass, I think I'll merge it into devel branch (or wait for Dominik to double-check).