-
Notifications
You must be signed in to change notification settings - Fork 14
Fix VCR examples for VCR off #550
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
thanks @maelle |
|
@sckott do you think this is a correct fix? |
|
Sorry for delay @maelle - I was trying to figure it out locally for a while, then got busy with work and life. I'll look again ASAP |
|
Friendly reminder, but no pressure 😸 |
sckott
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @maelle can you review now? Added the eject_cassette early return, and added a test. What do you think?
maelle
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!!
| @@ -0,0 +1,22 @@ | |||
| test_that("insert_example_cassette works as expected", { | |||
| withr::with_envvar(new = c("VCR_TURN_OFF" = "true"), { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be skipped if offline
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, or maybe we use webfakes to ping a local server, ill try both
cc @drmowinckels
This is not tested and not enough.
When I try to run examples that use vcr when VCR is off, I get the error:
from https://github.com/ropensci/vcr/blob/42fad406bf43519ffa535ee2316082339fc3bbf8/R/examples.R#L61C3-L61C26
So some earlier escaping is needed.
But a remaining problem is that if no cassette is inserted,
vcr::eject_cassette()errors.In
local_cassette(), the ejecting function is called conditionally.vcr/R/use_cassette.R
Line 146 in 42fad40
Maybe
vcr::eject_cassette()should also have an earlyreturn()when vcr is off? Thoughts?