]> khamidou — GitHub mirrors - vcrpy.git/commitdiff
Add force reset around calls to actual connection from stubs, to ensure
authorIvan Malison <IvanMalison@gmail.com>
Fri, 26 Dec 2014 10:07:02 +0000 (05:07 -0500)
committerIvan Malison <IvanMalison@gmail.com>
Fri, 26 Dec 2014 10:10:20 +0000 (05:10 -0500)
compatibility with version of httplib/urlib2 in python 2.7.9. Closes #130.

vcr/stubs/__init__.py

index 92a5a0178d9c34a13c07e856c2debe443f20b600..bad8a8345c68e0464238161de829d771ae9cd02b 100644 (file)
@@ -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()