Open dragonpaw opened 2 years ago
@dragonpaw I had this same problem some time ago; since I couldn't find any existing solution I wrote a pytest plugin that deletes cassettes of failed test by using a flexible decorator. It does not depends on pytest-recording directly, but integrates nicely with it since it uses its same cassettes' default path. See if it suits your needs.
Also, folks of pytest-recording, you're more than welcome to take a look at the code, if this is a feature you recon would be interesting to have integrated in here!
Is your feature request related to a problem? Please describe. When I'm building a new test, I'll run the test with --record-mode=once, but the test might fail (since it's new) and I then have to go delete the file so it'll re-record. It's kinda an annoyance to go find and make sure I delete the right file.
Describe the solution you'd like I'd love it if there was some logic where when running with --record-mode=once it only saved the files from the tests that pass, then I could write a bunch of new tests, run them all, the good ones would get saved, and then I'd go fix the ones that didn't pass.
Just kinda a nice to have I'd think. Definitely not a big issue. Though it seems odd to save a cassette for a failed test in general.
Describe alternatives you've considered Considered --record-mode=any, but that would re-run unrelated tests that I'm not working on.