1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-10 17:45:35 +00:00

requests 2.3 compat

This commit is contained in:
Kevin McCarthy
2014-05-17 12:51:47 -10:00
parent 0c1f1e2479
commit 70abc5058c
3 changed files with 83 additions and 34 deletions

View File

@@ -5,7 +5,8 @@ env:
- secure: AifoKzwhjV94cmcQZrdQmqRu/9rkZZvWpwBv1daeAQpLOKFPGsOm3D+x2cSw9+iCfkgDZDfqQVv1kCaFVxTll8v8jTq5SJdqEY0NmGWbj/UkNtShh609oRDsuzLxAEwtVKYjf/h8K2BRea+bl1tGkwZ2vtmYS6dxNlAijjWOfds= - secure: AifoKzwhjV94cmcQZrdQmqRu/9rkZZvWpwBv1daeAQpLOKFPGsOm3D+x2cSw9+iCfkgDZDfqQVv1kCaFVxTll8v8jTq5SJdqEY0NmGWbj/UkNtShh609oRDsuzLxAEwtVKYjf/h8K2BRea+bl1tGkwZ2vtmYS6dxNlAijjWOfds=
- secure: LBSEg/gMj4u4Hrpo3zs6Y/1mTpd2RtcN49mZIFgTdbJ9IhpiNPqcEt647Lz94F9Eses2x2WbNuKqZKZZReY7QLbEzU1m0nN5jlaKrjcG5NR5clNABfFFyhgc0jBikyS4abAG8jc2efeaTrFuQwdoF4sE8YiVrkiVj2X5Xoi6sBk= - secure: LBSEg/gMj4u4Hrpo3zs6Y/1mTpd2RtcN49mZIFgTdbJ9IhpiNPqcEt647Lz94F9Eses2x2WbNuKqZKZZReY7QLbEzU1m0nN5jlaKrjcG5NR5clNABfFFyhgc0jBikyS4abAG8jc2efeaTrFuQwdoF4sE8YiVrkiVj2X5Xoi6sBk=
matrix: matrix:
- WITH_LIB="requests2.x" - WITH_LIB="requests2.2"
- WITH_LIB="requests2.3"
- WITH_LIB="requests1.x" - WITH_LIB="requests1.x"
- WITH_LIB="httplib2" - WITH_LIB="httplib2"
- WITH_LIB="boto" - WITH_LIB="boto"
@@ -15,15 +16,21 @@ matrix:
exclude: exclude:
- env: WITH_LIB="boto" - env: WITH_LIB="boto"
python: 3.3 python: 3.3
- env: WITH_LIB="boto"
python: 3.4
- env: WITH_LIB="requests1.x"
python: 3.4
python: python:
- 2.6 - 2.6
- 2.7 - 2.7
- 3.3 - 3.3
- 3.4
- pypy - pypy
install: install:
- pip install PyYAML pytest pytest-localserver --use-mirrors - pip install PyYAML pytest pytest-localserver --use-mirrors
- if [ $WITH_LIB = "requests1.x" ] ; then pip install requests==1.2.3; fi - if [ $WITH_LIB = "requests1.x" ] ; then pip install requests==1.2.3; fi
- if [ $WITH_LIB = "requests2.x" ] ; then pip install requests; fi - if [ $WITH_LIB = "requests2.2" ] ; then pip install requests==2.2.1; fi
- if [ $WITH_LIB = "requests2.3" ] ; then pip install requests==2.3.0; fi
- if [ $WITH_LIB = "httplib2" ] ; then pip install httplib2; fi - if [ $WITH_LIB = "httplib2" ] ; then pip install httplib2; fi
- if [ $WITH_LIB = "boto" ] ; then pip install boto; fi - if [ $WITH_LIB = "boto" ] ; then pip install boto; fi
script: python setup.py test script: python setup.py test

103
tox.ini
View File

@@ -10,15 +10,18 @@ envlist =
py33, py33,
py34, py34,
pypy, pypy,
py26requests, py26requests23,
py27requests, py27requests23,
py34requests, py34requests23,
pypyrequests, pypyrequests23,
py26oldrequests, py26requests22,
py27oldrequests, py27requests22,
py33oldrequests, py34requests22,
py34oldrequests, pypyrequests22,
pypyoldrequests, py26requests1,
py27requests1,
py33requests1,
pypyrequests1,
py26httplib2, py26httplib2,
py27httplib2, py27httplib2,
py33httplib2, py33httplib2,
@@ -34,7 +37,7 @@ deps =
pytest-localserver pytest-localserver
PyYAML PyYAML
[testenv:py26oldrequests] [testenv:py26requests1]
basepython = python2.6 basepython = python2.6
deps = deps =
mock mock
@@ -43,7 +46,7 @@ deps =
PyYAML PyYAML
requests==1.2.3 requests==1.2.3
[testenv:py27oldrequests] [testenv:py27requests1]
basepython = python2.7 basepython = python2.7
deps = deps =
mock mock
@@ -52,7 +55,7 @@ deps =
PyYAML PyYAML
requests==1.2.3 requests==1.2.3
[testenv:py33oldrequests] [testenv:py33requests1]
basepython = python3.3 basepython = python3.3
deps = deps =
mock mock
@@ -61,16 +64,7 @@ deps =
PyYAML PyYAML
requests==1.2.3 requests==1.2.3
[testenv:py34oldrequests] [testenv:pypyrequests1]
basepython = python3.4
deps =
mock
pytest
pytest-localserver
PyYAML
requests==1.2.3
[testenv:pypyoldrequests]
basepython = pypy basepython = pypy
deps = deps =
mock mock
@@ -79,50 +73,95 @@ deps =
PyYAML PyYAML
requests==1.2.3 requests==1.2.3
[testenv:py26requests] [testenv:py26requests23]
basepython = python2.6 basepython = python2.6
deps = deps =
mock mock
pytest pytest
pytest-localserver pytest-localserver
PyYAML PyYAML
requests requests==2.3.0
[testenv:py27requests] [testenv:py27requests23]
basepython = python2.7 basepython = python2.7
deps = deps =
mock mock
pytest pytest
pytest-localserver pytest-localserver
PyYAML PyYAML
requests requests==2.3.0
[testenv:py33requests] [testenv:py33requests23]
basepython = python3.4 basepython = python3.4
deps = deps =
mock mock
pytest pytest
pytest-localserver pytest-localserver
PyYAML PyYAML
requests requests==2.3.0
[testenv:py34requests] [testenv:py34requests23]
basepython = python3.4 basepython = python3.4
deps = deps =
mock mock
pytest pytest
pytest-localserver pytest-localserver
PyYAML PyYAML
requests requests==2.3.0
[testenv:pypyrequests] [testenv:pypyrequests23]
basepython = pypy basepython = pypy
deps = deps =
mock mock
pytest pytest
pytest-localserver pytest-localserver
PyYAML PyYAML
requests requests==2.3.0
[testenv:py26requests22]
basepython = python2.6
deps =
mock
pytest
pytest-localserver
PyYAML
requests==2.2.1
[testenv:py27requests22]
basepython = python2.7
deps =
mock
pytest
pytest-localserver
PyYAML
requests==2.2.1
[testenv:py33requests22]
basepython = python3.4
deps =
mock
pytest
pytest-localserver
PyYAML
requests==2.2.1
[testenv:py34requests22]
basepython = python3.4
deps =
mock
pytest
pytest-localserver
PyYAML
requests==2.2.1
[testenv:pypyrequests22]
basepython = pypy
deps =
mock
pytest
pytest-localserver
PyYAML
requests==2.2.1
[testenv:py26httplib2] [testenv:py26httplib2]
basepython = python2.6 basepython = python2.6

View File

@@ -285,6 +285,9 @@ class VCRConnection:
self.real_connection.sock = value self.real_connection.sock = value
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
if six.PY3:
kwargs.pop('strict', None) # apparently this is gone in py3
# need to temporarily reset here because the real connection # need to temporarily reset here because the real connection
# inherits from the thing that we are mocking out. Take out # inherits from the thing that we are mocking out. Take out
# the reset if you want to see what I mean :) # the reset if you want to see what I mean :)