You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
It might be convenient to use _vcr.use_cassette directly for granular control of VCR setup & teardown mechanisms.
Describe the solution you'd like
Create a separate function that will not depend on pytest-related types & expose it as a part of the public API. It might be used by _vcr.use_cassette under the hood (or, likely, _vcr.use_cassette will be renamed to something else, and the new function will take this name).
pytest-vcr has a vcr fixture that gives you the configured VCR object so you can swap cassettes mid-test and test non-safe methods in 'once' recording mode.
Allowing me to use VCR is module or session scope to setup several object that would then be the basis for related sets of tests. Today, I would have to do something like this:
@pytest.mark.vcr()
def test_one():
with vcr.use_cassette("p4_ipv.yaml"):
ipv = pi.ipv("[email protected]")
# now use the ipv object in further code
@pytest.mark.vcr()
def test_two():
with vcr.use_cassette("p4_ipv.yaml"):
ipv = pi.ipv("[email protected]")
# now use the ipv object in further code
Which is less than ideal. I'd like to be able to refactor the common code out into a fixture. The fixture may want to be allowed to be function, module, or session scope.
Is your feature request related to a problem? Please describe.
It might be convenient to use
_vcr.use_cassette
directly for granular control of VCR setup & teardown mechanisms.Describe the solution you'd like
Create a separate function that will not depend on pytest-related types & expose it as a part of the public API. It might be used by
_vcr.use_cassette
under the hood (or, likely,_vcr.use_cassette
will be renamed to something else, and the new function will take this name).Additional context
Requested by @selevit
The text was updated successfully, but these errors were encountered: