1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-09 01:03:24 +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:
Rishab Malik
2019-06-13 16:46:17 -04:00
parent 9039eab916
commit 95c7898b65
2 changed files with 97 additions and 1 deletions

View File

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