vcr.errors.CannotOverwriteExistingCassetteException: No match for the request (<Request (GET) http://webservices.coala.io/list/bears>) was found. Can't overwrite existing cassette ('tests/cassettes/coatils_list_bears.yaml') in your current record mode ('once').
urlopen error [Errno 61] Connection refusedexceptions in py2 while py3 correctly replays the cassette (I did generate the cassette in py3 if that matters). The project is using urllib, and future was added to support py2/3 compatibility. It seems like in py2 vcr isn't wrapping/patching correctly. Anyone have experience with that or suggestions on how to deal with that? I am basically using defaults for everything here. Here is an extraction of the code (not from the test itself) that throws the exception (trimmed for brevity and relevance):
from __future__ import (absolute_import, division, print_function, unicode_literals) from builtins import object from future import standard_library standard_library.install_aliases() import urllib.request request = urllib.request.Request(uri, post_data, headers) response = urllib.request.urlopen(request)
guess its due to the way python-future imports the urllib stuff. I am able to make it work by importing like this (yuck...):
if sys.version_info > (3, 3): from urllib.parse import urlparse, urlencode from urllib.request import urlopen, Request from urllib.error import HTTPError else: from urlparse import urlparse from urllib import urlencode from urllib2 import urlopen, Request, HTTPError
the try...except way of doing it didn't work, but maybe I need to play around with the future stuff some more
from urllib.request import urlopen
from requests import request
with vcr.use_cassette('fixtures/vcr_cassettes/deva.yaml') as cass:
r = request('get', 'http://jsonplaceholder.typicode.com/')
with vcr.use_cassette('fixtures/vcr_cassettes/synopsis.yaml') as cass:
response = urlopen('http://www.zombo.com/').read()
assert len(cass) == 1
'tag:yaml.org,2002:python/unicode'or is it just in migration testcase?