Open maelle opened 4 years ago
Good idea.
Could a template live somewhere in this package?
probably yes
Maybe use_vcr
could mention that the user can run another function to get this template? as it might be too much to have the info that use_vcr
prints plus all of this.
For packages with authentication, the template should also include a line about what the vcr config of the package does to protect API keys.
In the template, mention how vcr works, but also basic troubleshooting advice (or a link to basic troubleshooting advice) such as "Have you tried re-recording the fixture(s)?".
include a line about what the vcr config of the package does to protect API keys
good idea
also basic troubleshooting advice
in this chapter? https://books.ropensci.org/http-testing/gotchas.html
an eg PR https://github.com/ropensci/taxize/pull/805
I think we need some tooling for contributors to help them manipulate cassettes (and files on disk if applicable) - e.g,. we could have a fxn that takes as input the exported package fxn name the user is working on testing, then delete all cassettes associated with that fxn. I guess ideally it'd not be greedy, so conservatively deleting cassette files.
I think we need some tooling for contributors to help them manipulate cassettes (and files on disk if applicable) - e.g,. we could have a fxn that takes as input the exported package fxn name the user is working on testing, then delete all cassettes associated with that fxn. I guess ideally it'd not be greedy, so conservatively deleting cassette files.
That sounds like an excellent idea! How would you guess which cassettes are associated with the function?
If the test file is named correctly, then all cassettes created in the test file corresponding to the function.
But what about cassettes created by other test files?
Should you open another issue about this function?
And maybe I'll wait on the contributing advice template, if the workflow is meant to get smoother with such helpers.
How would you guess which cassettes are associated with the function?
I don't know yet. leveraging whatever covr does perhaps
this issue: https://github.com/ropensci/vcr/issues/103 which is waiting on https://github.com/ropensci/vcr/issues/152 to be done first.
General advice in the book https://books.ropensci.org/http-testing/contributor-friendliness.html
Packages that use vcr for testing have the need for similar guidelines regarding testing (at least as long as the use of cassettes isn't widespread).
use_vcr()
, "add the following lines to your contributing guide".use_vcr()
ends up editing the gitattributes to hide cassette diffs, the contributing guide should mention that as well.How such a template could look like.