1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-10 01:25:34 +00:00

Compare commits

..

9 Commits

Author SHA1 Message Date
Kevin McCarthy
ef727aaaaf bump version 2017-05-27 16:47:11 -10:00
Kevin McCarthy
ee17233aa0 only need to run flakes on one version of python 2017-05-27 16:00:11 -10:00
Kevin McCarthy
f88294a9e6 Drop a couple old versions of python
According to the devguide: https://docs.python.org/devguide/

Python 3.3 is officially supported until 2017-09-29 and 3.4 until
2019-03-16

But I'm tired of waiting for my tests to run on Travis :-P
2017-05-27 15:52:59 -10:00
Kevin McCarthy
572da2084d Fix pyflake issue 2017-05-27 15:43:24 -10:00
Kevin McCarthy
88bf8f0aac proxy getattr to the real connection too 2017-05-27 15:40:42 -10:00
Kevin McCarthy
9b59e02374 Fix compat with requests 2.16 (unvendored urllib3)
The new version of requests un-vendors urllib3, with a nifty hack:
https://github.com/kennethreitz/requests/blob/master/requests/packages.py

Unfortunately messing directly with sys.modules causes some weird
behavior that I don't entirely understand.  Avoiding the extra import to
requests.packages as part of VCR's initialization seems to sidestep the
issue.

Closes #311
2017-05-27 15:40:38 -10:00
Kevin McCarthy
ba290a32d2 Add new version of urllib3 to tox
Also remove ancient version in the interest of test speed
2017-05-27 15:38:42 -10:00
Kevin McCarthy
420c2ceb6f add new requests version 2017-05-27 10:57:41 -10:00
Kevin McCarthy
ec786f2fd9 pass all args to runtests 2017-05-27 10:57:25 -10:00
8 changed files with 54 additions and 35 deletions

View File

@@ -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

View File

@@ -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)

View File

@@ -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 $*

View File

@@ -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
View File

@@ -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

View File

@@ -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):

View File

@@ -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):

View File

@@ -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