mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-10 01:25:34 +00:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ef727aaaaf | ||
|
|
ee17233aa0 | ||
|
|
f88294a9e6 | ||
|
|
572da2084d | ||
|
|
88bf8f0aac | ||
|
|
9b59e02374 | ||
|
|
ba290a32d2 | ||
|
|
420c2ceb6f | ||
|
|
ec786f2fd9 |
19
.travis.yml
19
.travis.yml
@@ -14,13 +14,14 @@ env:
|
||||
- TOX_SUFFIX="requests26"
|
||||
- TOX_SUFFIX="requests27"
|
||||
- TOX_SUFFIX="requests213"
|
||||
- TOX_SUFFIX="requests216"
|
||||
- TOX_SUFFIX="requests1"
|
||||
- TOX_SUFFIX="httplib2"
|
||||
- TOX_SUFFIX="boto"
|
||||
- TOX_SUFFIX="boto3"
|
||||
- TOX_SUFFIX="urllib317"
|
||||
- TOX_SUFFIX="urllib319"
|
||||
- TOX_SUFFIX="urllib3110"
|
||||
- TOX_SUFFIX="urllib3121"
|
||||
- TOX_SUFFIX="tornado3"
|
||||
- TOX_SUFFIX="tornado4"
|
||||
- TOX_SUFFIX="aiohttp"
|
||||
@@ -31,10 +32,16 @@ matrix:
|
||||
exclude:
|
||||
- env: TOX_SUFFIX="flakes"
|
||||
python: 2.6
|
||||
- env: TOX_SUFFIX="boto"
|
||||
python: 3.3
|
||||
- env: TOX_SUFFIX="boto"
|
||||
- env: TOX_SUFFIX="flakes"
|
||||
python: 2.7
|
||||
- env: TOX_SUFFIX="flakes"
|
||||
python: 3.4
|
||||
- env: TOX_SUFFIX="flakes"
|
||||
python: 3.5
|
||||
- env: TOX_SUFFIX="flakes"
|
||||
python: pypy
|
||||
- env: TOX_SUFFIX="flakes"
|
||||
python: pypy3
|
||||
- env: TOX_SUFFIX="boto"
|
||||
python: 3.6
|
||||
- env: TOX_SUFFIX="requests1"
|
||||
@@ -47,8 +54,6 @@ matrix:
|
||||
python: 2.6
|
||||
- env: TOX_SUFFIX="aiohttp"
|
||||
python: 2.7
|
||||
- env: TOX_SUFFIX="aiohttp"
|
||||
python: 3.3
|
||||
- env: TOX_SUFFIX="aiohttp"
|
||||
python: pypy
|
||||
- env: TOX_SUFFIX="aiohttp"
|
||||
@@ -56,8 +61,6 @@ matrix:
|
||||
python:
|
||||
- 2.6
|
||||
- 2.7
|
||||
- 3.3
|
||||
- 3.4
|
||||
- 3.5
|
||||
- 3.6
|
||||
- pypy
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
Changelog
|
||||
---------
|
||||
- 1.11.1 Fix compatibility with newest requests and urllib3 releases
|
||||
- 1.11.0 Allow injection of persistence methods + bugfixes (thanks @j-funk and @IvanMalison),
|
||||
Support python 3.6 + CI tests (thanks @derekbekoe and @graingert),
|
||||
Support pytest-asyncio coroutines (thanks @graingert)
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
REQUESTS_CA_BUNDLE=`python -m pytest_httpbin.certs` py.test $1
|
||||
REQUESTS_CA_BUNDLE=`python -m pytest_httpbin.certs` py.test $*
|
||||
|
||||
2
setup.py
2
setup.py
@@ -56,7 +56,7 @@ if sys.version_info[0] == 2:
|
||||
|
||||
setup(
|
||||
name='vcrpy',
|
||||
version='1.11.0',
|
||||
version='1.11.1',
|
||||
description=(
|
||||
"Automatically mock your HTTP interactions to simplify and "
|
||||
"speed up testing"
|
||||
|
||||
17
tox.ini
17
tox.ini
@@ -1,5 +1,5 @@
|
||||
[tox]
|
||||
envlist = {py26,py27,py33,py34,py35,py36,pypy,pypy3}-{flakes,requests213,requests27,requests26,requests25,requests24,requests23,requests22,requests1,httplib2,urllib317,urllib319,urllib3110,tornado3,tornado4,boto,boto3,aiohttp}
|
||||
envlist = {py26,py27,py35,py36,pypy,pypy3}-{flakes,requests216,requests213,requests27,requests26,requests25,requests24,requests23,requests22,requests1,httplib2,urllib319,urllib3110,urllib3121,tornado3,tornado4,boto,boto3,aiohttp}
|
||||
|
||||
[testenv:flakes]
|
||||
skipsdist = True
|
||||
@@ -20,6 +20,7 @@ deps =
|
||||
pytest-httpbin
|
||||
PyYAML
|
||||
requests1: requests==1.2.3
|
||||
requests216: requests==2.16.3
|
||||
requests213: requests==2.13.0
|
||||
requests27: requests==2.7.0
|
||||
requests26: requests==2.6.0
|
||||
@@ -28,15 +29,15 @@ deps =
|
||||
requests23: requests==2.3.0
|
||||
requests22: requests==2.2.1
|
||||
httplib2: httplib2
|
||||
urllib317: urllib3==1.7.1
|
||||
urllib319: urllib3==1.9.1
|
||||
urllib3110: urllib3==1.10.2
|
||||
{py26,py27,py33,py34,py35,py36,pypy}-tornado3: tornado>=3,<4
|
||||
{py26,py27,py33,py34,py35,py36,pypy}-tornado4: tornado>=4,<5
|
||||
{py26,py27,py33,py34,py35,py36,pypy}-tornado3: pytest-tornado
|
||||
{py26,py27,py33,py34,py35,py36,pypy}-tornado4: pytest-tornado
|
||||
{py26,py27,py33,py34,py35,py36}-tornado3: pycurl
|
||||
{py26,py27,py33,py34,py35,py36}-tornado4: pycurl
|
||||
urllib3121: urllib3==1.21.1
|
||||
{py26,py27,py35,py36,pypy}-tornado3: tornado>=3,<4
|
||||
{py26,py27,py35,py36,pypy}-tornado4: tornado>=4,<5
|
||||
{py26,py27,py35,py36,pypy}-tornado3: pytest-tornado
|
||||
{py26,py27,py35,py36,pypy}-tornado4: pytest-tornado
|
||||
{py26,py27,py35,py36}-tornado3: pycurl
|
||||
{py26,py27,py35,py36}-tornado4: pycurl
|
||||
boto: boto
|
||||
boto3: boto3
|
||||
aiohttp: aiohttp
|
||||
|
||||
32
vcr/patch.py
32
vcr/patch.py
@@ -12,16 +12,6 @@ _HTTPConnection = httplib.HTTPConnection
|
||||
_HTTPSConnection = httplib.HTTPSConnection
|
||||
|
||||
|
||||
# Try to save the original types for requests
|
||||
try:
|
||||
import requests.packages.urllib3.connectionpool as cpool
|
||||
except ImportError: # pragma: no cover
|
||||
pass
|
||||
else:
|
||||
_VerifiedHTTPSConnection = cpool.VerifiedHTTPSConnection
|
||||
_cpoolHTTPConnection = cpool.HTTPConnection
|
||||
_cpoolHTTPSConnection = cpool.HTTPSConnection
|
||||
|
||||
# Try to save the original types for boto3
|
||||
try:
|
||||
import botocore.vendored.requests.packages.urllib3.connectionpool as cpool
|
||||
@@ -32,14 +22,27 @@ else:
|
||||
_cpoolBoto3HTTPConnection = cpool.HTTPConnection
|
||||
_cpoolBoto3HTTPSConnection = cpool.HTTPSConnection
|
||||
|
||||
|
||||
cpool = None
|
||||
# Try to save the original types for urllib3
|
||||
try:
|
||||
import urllib3
|
||||
import urllib3.connectionpool as cpool
|
||||
except ImportError: # pragma: no cover
|
||||
pass
|
||||
else:
|
||||
_VerifiedHTTPSConnection = urllib3.connectionpool.VerifiedHTTPSConnection
|
||||
_VerifiedHTTPSConnection = cpool.VerifiedHTTPSConnection
|
||||
_cpoolHTTPConnection = cpool.HTTPConnection
|
||||
_cpoolHTTPSConnection = cpool.HTTPSConnection
|
||||
|
||||
# Try to save the original types for requests
|
||||
try:
|
||||
if not cpool:
|
||||
import requests.packages.urllib3.connectionpool as cpool
|
||||
except ImportError: # pragma: no cover
|
||||
pass
|
||||
else:
|
||||
_VerifiedHTTPSConnection = cpool.VerifiedHTTPSConnection
|
||||
_cpoolHTTPConnection = cpool.HTTPConnection
|
||||
_cpoolHTTPSConnection = cpool.HTTPSConnection
|
||||
|
||||
|
||||
# Try to save the original types for httplib2
|
||||
@@ -176,10 +179,9 @@ class CassettePatcherBuilder(object):
|
||||
|
||||
def _requests(self):
|
||||
try:
|
||||
import requests.packages.urllib3.connectionpool as cpool
|
||||
from .stubs import requests_stubs
|
||||
except ImportError: # pragma: no cover
|
||||
return ()
|
||||
from .stubs import requests_stubs
|
||||
return self._urllib3_patchers(cpool, requests_stubs)
|
||||
|
||||
def _boto3(self):
|
||||
|
||||
@@ -334,6 +334,18 @@ class VCRConnection(object):
|
||||
|
||||
super(VCRConnection, self).__setattr__(name, value)
|
||||
|
||||
def __getattr__(self, name):
|
||||
"""
|
||||
Send requests for weird attributes up to the real connection
|
||||
(counterpart to __setattr above)
|
||||
"""
|
||||
if self.__dict__.get('real_connection'):
|
||||
# check in case real_connection has not been set yet, such as when
|
||||
# we're setting the real_connection itself for the first time
|
||||
return getattr(self.real_connection, name)
|
||||
|
||||
return super(VCRConnection, self).__getattr__(name)
|
||||
|
||||
|
||||
for k, v in HTTPConnection.__dict__.items():
|
||||
if isinstance(v, staticmethod):
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
'''Stubs for requests'''
|
||||
|
||||
try:
|
||||
from requests.packages.urllib3.connectionpool import HTTPConnection, VerifiedHTTPSConnection
|
||||
except ImportError:
|
||||
from urllib3.connectionpool import HTTPConnection, VerifiedHTTPSConnection
|
||||
except ImportError:
|
||||
from requests.packages.urllib3.connectionpool import HTTPConnection, VerifiedHTTPSConnection
|
||||
|
||||
from ..stubs import VCRHTTPConnection, VCRHTTPSConnection
|
||||
|
||||
|
||||
Reference in New Issue
Block a user