vcrpy
vcrpy copied to clipboard
Option `allow_playback_repeats` doesn't work on record
trafficstars
It appears that the allow_playback_repeats option doesn't work on record (though I'm not sure if that was intended).
The following test will record two requests when first creating the cassette.
def test_multiple_requests():
with vcr.use_cassette('cassettes/cassette.yaml', allow_playback_repeats=True) as cass:
response1 = requests.get("http://example.com")
response2 = requests.get("http://example.com")
assert response1.status_code == 200
assert response2.status_code == 200
This could be fixed by modifying the following: https://github.com/kevin1024/vcrpy/blob/ce27c636857b49c71e9a3ffe0f0bee9135fba181/vcr/cassette.py#L250
To something like:
return request and request in self and self.record_mode != RecordMode.ALL and (self.rewound or self.allow_playback_repeats)