@pytest.mark.vcr
def test_simple(vcr_cassette):
# Given
<insert test assumptions>
# When
<insert actual test scenario>
# Then
assert vcr_cassette.all_played
assert vcr_cassette.play_count == 8
When I run my tests with VCR disabled the play_count is 0..... Understandably.
I'd like to change this to:
if not vcr_disabled:
assert vcr_cassette.play_count == 8
But it seems that the pytest-vcr marker doesn't have an obvious way to check if the lambda was set to None.
I'll have a crack at a PR later that exposes on the _vcr_marker fixture a boolean property that can get assigned at that point in the code I linked but defaults to False unless it hits that code path.
I am running a test like this:
When I run my tests with VCR disabled the
play_count
is 0..... Understandably.I'd like to change this to:
But it seems that the pytest-vcr marker doesn't have an obvious way to check if the lambda was set to None.
https://github.com/ktosiek/pytest-vcr/blob/4fb277ee37b8b89d0fe7139bc79597db32f024fd/pytest_vcr.py#L59
I'll have a crack at a PR later that exposes on the
_vcr_marker
fixture a boolean property that can get assigned at that point in the code I linked but defaults to False unless it hits that code path.