From: Ivan Malison Date: Fri, 26 Dec 2014 10:07:02 +0000 (-0500) Subject: Add force reset around calls to actual connection from stubs, to ensure X-Git-Tag: v1.1.4~1 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=e1f65bcbdc8e7c408a9787b59f57469da918c707;p=vcrpy.git Add force reset around calls to actual connection from stubs, to ensure compatibility with version of httplib/urlib2 in python 2.7.9. Closes #130. --- diff --git a/vcr/stubs/__init__.py b/vcr/stubs/__init__.py index 92a5a01..bad8a83 100644 --- a/vcr/stubs/__init__.py +++ b/vcr/stubs/__init__.py @@ -236,12 +236,16 @@ class VCRConnection(object): self._vcr_request ) ) - self.real_connection.request( - method=self._vcr_request.method, - url=self._url(self._vcr_request.uri), - body=self._vcr_request.body, - headers=self._vcr_request.headers, - ) + # This is imported here to avoid circular import. + # TODO(@IvanMalison): Refactor to allow normal import. + from vcr.patch import force_reset + with force_reset(): + self.real_connection.request( + method=self._vcr_request.method, + url=self._url(self._vcr_request.uri), + body=self._vcr_request.body, + headers=self._vcr_request.headers, + ) # get the response response = self.real_connection.getresponse()