question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] Using `once` record_mode gives error

See original GitHub issue

Problem

Using once gives an error:

vcr.errors.CannotOverwriteExistingCassetteException: Can't overwrite existing cassette ([PATH_OF_CASETTE_FILE]) in your current record mode ('once').
E               No match for the request (<Request (GET) https://postman-echo.com/get?foo1=bar1&foo2=bar2>) was found.
E               No similar requests, that have not been played, found.

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

import pytest
import requests

@pytest.mark.vcr(record_mode="once")
def test_vcr():
    response = requests.get("https://postman-echo.com/get?foo1=bar1&foo2=bar2")
    assert response.status_code == 200

Stacktrace

Click to expand!
../../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)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
paxcodescommented, Jun 13, 2020

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 .

0reactions
paxcodescommented, Jun 15, 2020

Works perfectly. Thanks once again @Stranger6667!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Netsuite bug when creating customerdeposit record
After a reply on the Netsuite user group prompted me to use the {recordmode:'dynamic'} attributes I am getting a strange error.
Read more >
Solved: Why is nothing showing up in record mode? - 9471644
Solved: Hi! Just upgraded to the new full-fledged version, and although I can see my puppet in 'rig' mode, I'm suddenly getting a...
Read more >
Screenshot Overlay Doesn't Go Away - Apple Community
When I take a screenshot (Command+Shift+5), the area selector appears, I make the necessary selection adjustment, then click Return.
Read more >
0RECORDMODE field values updated incorrectly
Dear All, we have and issue with 0recordmode field in the datasource 0FI_AP_4 , as per our analysis the field has other values...
Read more >
Animation Window undo error in rec mode after preview offset
Getting an InvalidOperationException error after the following operations in the Animation window. This can be reproduced with a sin...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found