mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-09 01:03:24 +00:00
Fix compatibility with Python 3.7
This commit is contained in:
1
setup.py
1
setup.py
@@ -62,6 +62,7 @@ setup(
|
|||||||
'Programming Language :: Python :: 3.4',
|
'Programming Language :: Python :: 3.4',
|
||||||
'Programming Language :: Python :: 3.5',
|
'Programming Language :: Python :: 3.5',
|
||||||
'Programming Language :: Python :: 3.6',
|
'Programming Language :: Python :: 3.6',
|
||||||
|
'Programming Language :: Python :: 3.7',
|
||||||
'Programming Language :: Python :: Implementation :: CPython',
|
'Programming Language :: Python :: Implementation :: CPython',
|
||||||
'Programming Language :: Python :: Implementation :: PyPy',
|
'Programming Language :: Python :: Implementation :: PyPy',
|
||||||
'Topic :: Software Development :: Testing',
|
'Topic :: Software Development :: Testing',
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
'''Integration tests with urllib2'''
|
'''Integration tests with urllib2'''
|
||||||
|
|
||||||
|
import ssl
|
||||||
from six.moves.urllib.request import urlopen
|
from six.moves.urllib.request import urlopen
|
||||||
from six.moves.urllib_parse import urlencode
|
from six.moves.urllib_parse import urlencode
|
||||||
import pytest_httpbin.certs
|
import pytest_httpbin.certs
|
||||||
@@ -12,7 +13,9 @@ from assertions import assert_cassette_has_one_response
|
|||||||
|
|
||||||
|
|
||||||
def urlopen_with_cafile(*args, **kwargs):
|
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:
|
try:
|
||||||
return urlopen(*args, **kwargs)
|
return urlopen(*args, **kwargs)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
|
|||||||
@@ -136,7 +136,10 @@ class CassetteContextDecorator(object):
|
|||||||
except Exception:
|
except Exception:
|
||||||
to_yield = coroutine.throw(*sys.exc_info())
|
to_yield = coroutine.throw(*sys.exc_info())
|
||||||
else:
|
else:
|
||||||
to_yield = coroutine.send(to_send)
|
try:
|
||||||
|
to_yield = coroutine.send(to_send)
|
||||||
|
except StopIteration:
|
||||||
|
break
|
||||||
|
|
||||||
def _handle_function(self, fn):
|
def _handle_function(self, fn):
|
||||||
with self as cassette:
|
with self as cassette:
|
||||||
|
|||||||
Reference in New Issue
Block a user