betamaxpy / betamax

A VCR imitation designed only for python-requests.
https://betamax.readthedocs.io/en/latest/
Other
567 stars 62 forks source link

Changes to betamax_recorder fixture's current_cassette persist between tests #108

Closed rouge8 closed 8 years ago

rouge8 commented 8 years ago

Config changes to current_cassette on the betamax_recorder pytest fixture persist between tests. I expected changes to betamax_recorder.current_cassette to behave like a pytest function-scoped fixture, where betamax_recorder would be new and clean on each test.

With betamax==0.7.0, pytest==2.9.2 and the following tests, whichever test runs second will fail:

def test_headers(betamax_recorder):
    betamax_recorder.current_cassette.match_options.append('headers')
    assert betamax_recorder.current_cassette.match_options == [
        'method',
        'uri',
        'headers',
    ]

def test_body(betamax_recorder):
    betamax_recorder.current_cassette.match_options.append('body')
    assert betamax_recorder.current_cassette.match_options == [
        'method',
        'uri',
        'body',
    ]

Is this intended behavior?

sigmavirus24 commented 8 years ago

No it's not. I have a fix for it though and can create a 0.7.1 quick fix release for this.

sigmavirus24 commented 8 years ago

0.7.1 should fix this for you. Thanks for reporting it!

rouge8 commented 8 years ago

Thanks for the super fast fix!

sigmavirus24 commented 8 years ago

It does work, yes? (And you caught me in a slump while some deployments were finishing.)

rouge8 commented 8 years ago

Yup!

On Tuesday, June 14, 2016, Ian Cordasco notifications@github.com wrote:

It does work, yes? (And you caught me in a slump while some deployments were finishing.)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sigmavirus24/betamax/issues/108#issuecomment-226064970, or mute the thread https://github.com/notifications/unsubscribe/AAOdzZyHm04W1l0O98H4qtQMISD2KxQJks5qL1Z5gaJpZM4I1wp1 .