ropensci / vcr

Record HTTP calls and replay them
https://docs.ropensci.org/vcr
Other
77 stars 12 forks source link

Helpers for test file level and test_that chunk level cassette inspection/manipulation #103

Open sckott opened 5 years ago

sckott commented 5 years ago

It would make it easier to re-record cassettes, delete certain ones, etc. if there were fxns to tell the user what cassettes were associated with which test files and within each file, associated with which test_that blocks. e.g.,

summary/information

vcr_summary()
test-wm_distribution.R  
├── wm_distribution.yml
├── wm_distribution_.yml
├── wm_distribution_many.yml
test-wm_ranks.R
├── wm_ranks_id.yml
├── wm_ranks_id_error.yml
├── wm_ranks_name.yml
├── wm_ranks_name_error.yml

manipulation

delete

by test file - delete all cassettes used by the test file

# complete name
vcr_rm(files = "test-wm_distribution.R")
# partial name
vcr_rm(files = "wm_distribution.R")
vcr_rm(files = "wm_distribution")
# regex for one to many
vcr_rm(files = "wm_*", fuzzy = TRUE)

by test_that block - either require user to give file too, or just regex across all test_that blocks?

vcr_rm(block = "wm_distribution basic test")
maelle commented 4 years ago

I like this idea :-) it'd also help seeing duplicates cf #116

sckott commented 4 years ago

thanks for the upvote

sckott commented 4 years ago

wait for https://github.com/ropensci/vcr/issues/152 to have a full listing of test files, cassettes named within each test file, and associated fixture files