Closed paxcodes closed 4 years ago
Hi @paxcodes
Thank you for reporting this! Indeed it is strange, I'll take a look - a similar code with only VCR.py
has different behavior
The problem is, that record_mode
passed in the vcr
mark is not passed to VCR
. I'll fix that
I believe it also does not work when I use the vcr_config fixture to set the record_mode to 'once'
On Fri, Jun 12, 2020, 7:04 AM Dmitry Dygalo notifications@github.com wrote:
The problem is, that record_mode passed in the vcr mark is not passed to VCR. I'll fix that
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/kiwicom/pytest-recording/issues/47#issuecomment-643287425, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADIDWNTUDBB7FJ4CDKQM56TRWIYVNANCNFSM4N2YC2LQ .
We have this:
def load_cassette(cassette_path, serializer):
try:
with open(cassette_path) as f:
cassette_content = f.read()
except IOError:
return [], []
return deserialize(cassette_content, serializer)
But it actually should raise an error, but it interferes with some other parts - I am taking a deeper look
So, CombinedPersister
should raise an error only if no requests / responses were loaded from any cassettes. Will fix it soon
I released a fix in 0.8.1
. Let me know how it works for your case
Works perfectly. Thanks once again @Stranger6667!
Problem
Using
once
gives an error:I ran this the first time so PATH_OF_CASETTE_FILE shouldn't exist although the error seems to say it exists. I checked the PATH_OF_CASETTE_FILE that the error specifies before I run my test the 2nd time and indeed no such file exists.
To Reproduce
Stacktrace
Click to expand!
```sh ../../Library/Caches/pypoetry/virtualenvs/featuredproductsswitch-q2O7GQgj-py3.8/lib/python3.8/site-packages/requests/api.py:76: in get return request('get', url, params=params, **kwargs) ../../Library/Caches/pypoetry/virtualenvs/featuredproductsswitch-q2O7GQgj-py3.8/lib/python3.8/site-packages/requests/api.py:61: in request return session.request(method=method, url=url, **kwargs) ../../Library/Caches/pypoetry/virtualenvs/featuredproductsswitch-q2O7GQgj-py3.8/lib/python3.8/site-packages/requests/sessions.py:530: in request resp = self.send(prep, **send_kwargs) ../../Library/Caches/pypoetry/virtualenvs/featuredproductsswitch-q2O7GQgj-py3.8/lib/python3.8/site-packages/requests/sessions.py:643: in send r = adapter.send(request, **kwargs) ../../Library/Caches/pypoetry/virtualenvs/featuredproductsswitch-q2O7GQgj-py3.8/lib/python3.8/site-packages/requests/adapters.py:439: in send resp = conn.urlopen( ../../Library/Caches/pypoetry/virtualenvs/featuredproductsswitch-q2O7GQgj-py3.8/lib/python3.8/site-packages/urllib3/connectionpool.py:670: in urlopen httplib_response = self._make_request( ../../Library/Caches/pypoetry/virtualenvs/featuredproductsswitch-q2O7GQgj-py3.8/lib/python3.8/site-packages/urllib3/connectionpool.py:417: in _make_request httplib_response = conn.getresponse(buffering=True) ```