mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-09 17:15:35 +00:00
[DEV-5365][DEV-5367] VCR responses don't work with Biopython on Python 3 (#1)
* added IOBase methods and fp pointer * regression test
This commit is contained in:
@@ -60,9 +60,10 @@ def serialize_headers(response):
|
||||
|
||||
class VCRHTTPResponse(HTTPResponse):
|
||||
"""
|
||||
Stub reponse class that gets returned instead of a HTTPResponse
|
||||
Stub response class that gets returned instead of a HTTPResponse
|
||||
"""
|
||||
def __init__(self, recorded_response):
|
||||
self.fp = None
|
||||
self.recorded_response = recorded_response
|
||||
self.reason = recorded_response['status']['message']
|
||||
self.status = self.code = recorded_response['status']['code']
|
||||
@@ -93,9 +94,30 @@ class VCRHTTPResponse(HTTPResponse):
|
||||
def read(self, *args, **kwargs):
|
||||
return self._content.read(*args, **kwargs)
|
||||
|
||||
def readall(self):
|
||||
return self._content.readall()
|
||||
|
||||
def readinto(self, *args, **kwargs):
|
||||
return self._content.readinto(*args, **kwargs)
|
||||
|
||||
def readline(self, *args, **kwargs):
|
||||
return self._content.readline(*args, **kwargs)
|
||||
|
||||
def readlines(self, *args, **kwargs):
|
||||
return self._content.readlines(*args, **kwargs)
|
||||
|
||||
def seekable(self):
|
||||
return self._content.seekable()
|
||||
|
||||
def tell(self):
|
||||
return self._content.tell()
|
||||
|
||||
def isatty(self):
|
||||
return self._content.isatty()
|
||||
|
||||
def seek(self, *args, **kwargs):
|
||||
return self._content.seek(*args, **kwargs)
|
||||
|
||||
def close(self):
|
||||
self._closed = True
|
||||
return True
|
||||
@@ -121,6 +143,9 @@ class VCRHTTPResponse(HTTPResponse):
|
||||
else:
|
||||
return default
|
||||
|
||||
def readable(self):
|
||||
return self._content.readable()
|
||||
|
||||
|
||||
class VCRConnection(object):
|
||||
# A reference to the cassette that's currently being patched in
|
||||
|
||||
Reference in New Issue
Block a user