diff --git a/setup.py b/setup.py index 3935af6..65c0773 100644 --- a/setup.py +++ b/setup.py @@ -62,6 +62,7 @@ setup( 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', 'Topic :: Software Development :: Testing', diff --git a/tests/integration/test_urllib2.py b/tests/integration/test_urllib2.py index 8a633ba..3c0b021 100644 --- a/tests/integration/test_urllib2.py +++ b/tests/integration/test_urllib2.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- '''Integration tests with urllib2''' +import ssl from six.moves.urllib.request import urlopen from six.moves.urllib_parse import urlencode import pytest_httpbin.certs @@ -12,7 +13,9 @@ from assertions import assert_cassette_has_one_response def urlopen_with_cafile(*args, **kwargs): - kwargs['cafile'] = pytest_httpbin.certs.where() + context = ssl.create_default_context(cafile=pytest_httpbin.certs.where()) + context.check_hostname = False + kwargs['context'] = context try: return urlopen(*args, **kwargs) except TypeError: diff --git a/vcr/cassette.py b/vcr/cassette.py index d64dec6..3b6f54e 100644 --- a/vcr/cassette.py +++ b/vcr/cassette.py @@ -136,7 +136,10 @@ class CassetteContextDecorator(object): except Exception: to_yield = coroutine.throw(*sys.exc_info()) else: - to_yield = coroutine.send(to_send) + try: + to_yield = coroutine.send(to_send) + except StopIteration: + break def _handle_function(self, fn): with self as cassette: