kevin1024 / vcrpy

Automatically mock your HTTP interactions to simplify and speed up testing
MIT License
2.71k stars 386 forks source link

Allow setting custom persister as a normal option #575

Open gioele opened 3 years ago

gioele commented 3 years ago

Currently custom persisters must be registered by called the register_persister function on an existing VCR object, for example: my_vcr = vcr.VCR(); my_vcr.register_persister(MyPersister).

From an ergonomics point of view, it would be better if persisters could be treated just like any other option.

This would make it possible to set a custom persister when using function decorators @vcr.use_cassette("foo", mode="none", persister=MyPersister).

fiendish commented 8 months ago

Given that Cassette class takes a persister argument, it looks like this is supposed to work, but just doesn't? Can it be considered a bug that use_cassette doesn't pass it along?