]> khamidou — GitHub mirrors - vcrpy.git/commitdiff
Fix httplib2 compatibility with py37
authorLuiz Menezes <luiz.menezesf@gmail.com>
Tue, 18 Sep 2018 21:42:22 +0000 (18:42 -0300)
committerLuiz Menezes <luiz.menezesf@gmail.com>
Tue, 18 Sep 2018 21:42:22 +0000 (18:42 -0300)
tests/integration/test_httplib2.py
vcr/stubs/httplib2_stubs.py

index 05a25d314bbe0ed69d4787a1fa0f69a3cfa527d5..4eda032b10c77baaa3ad3b91e8076b913860ea05 100644 (file)
@@ -1,12 +1,12 @@
 # -*- coding: utf-8 -*-
 '''Integration tests with httplib2'''
 
-# External imports
+import sys
+
 from six.moves.urllib_parse import urlencode
 import pytest
 import pytest_httpbin.certs
 
-# Internal imports
 import vcr
 
 from assertions import assert_cassette_has_one_response
@@ -19,7 +19,12 @@ def http():
     Returns an httplib2 HTTP instance
     with the certificate replaced by the httpbin one.
     """
-    return httplib2.Http(ca_certs=pytest_httpbin.certs.where())
+    kwargs = {
+        'ca_certs': pytest_httpbin.certs.where()
+    }
+    if sys.version_info[:2] == (3, 7):
+        kwargs['disable_ssl_certificate_validation'] = True
+    return httplib2.Http(**kwargs)
 
 
 def test_response_code(tmpdir, httpbin_both):
index 4f31537553cd6877cf6761521a7bc36aa89f8ca8..3d83406c79ec0ab0b55df58a7d130ea9f36cc9b1 100644 (file)
@@ -40,6 +40,7 @@ class VCRHTTPSConnectionWithTimeout(VCRHTTPSConnection,
             'timeout',
             'source_address',
             'ca_certs',
+            'disable_ssl_certificate_validation',
         }
         unknown_keys = set(kwargs.keys()) - safe_keys
         safe_kwargs = kwargs.copy()