Skip to content
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

Improve debugging experience #192

Closed
maelle opened this issue Nov 17, 2020 · 3 comments · Fixed by #193
Closed

Improve debugging experience #192

maelle opened this issue Nov 17, 2020 · 3 comments · Fixed by #193
Milestone

Comments

@maelle
Copy link
Member

maelle commented Nov 17, 2020

From ropensci-books/http-testing#51 (comment)

  • Should vcr switch back to creating a helper file instead of a setup file? Helper files in tests/testthat are no longer recommended but they are still supported and have the advantage of being loaded by load_all(). See https://deploy-preview-134--admiring-allen-9a00b2.netlify.app/2020/11/18/testthat-utility-belt/ Otherwise in docs about debugging one would simply recommend to source the setup file, which isn't bad either.

  • Could vcr have a function à la testthat::test_path() that'd return the path to tests/fixtures when run in tests and when run from the root of the package? This way in the configuration there would be

library("vcr")
invisible(vcr::vcr_configure(
  dir = vcr::test_path("fixtures") # one could still choose another location
))
vcr::check_cassette_names()


where vcr::test_path("fixtures") is ../fixtures in tests, and tests/fixtures otherwise.

  • Could there be a vignette about debugging explaining the above and also mentioning insert_cassette()? Because if you are debugging the code in a test you might prefer using insert_cassette() instead of use_cassette(), as it allows more interactive debugging (you can run the code in the test, add a line, see retrying happening whereas testthat hides messages, etc)
@maelle
Copy link
Member Author

maelle commented Nov 17, 2020

A related question, could insert_cassette() return the cassette invisibly?

@sckott
Copy link
Collaborator

sckott commented Nov 19, 2020

Should vcr switch back to creating a helper file instead of a setup file

The current vcr version on cran still has helper instead of setup https://github.com/ropensci/vcr/blob/v0.5.4/R/vcr_setup.R so at least users of the cran version won't notice any change if we revert back to helper here.

I think it does make sense to go back to helper

If we go back to helper do we still need the test_path fxn?

@maelle
Copy link
Member Author

maelle commented Nov 19, 2020

Yes because the path in vcr_configure wouldn't work in both tests and from the root of the package

@sckott sckott added this to the v0.6 milestone Nov 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants