mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-09 01:03:24 +00:00
rename urllib3 patch method and rm unused imports from tests
This commit is contained in:
@@ -2,12 +2,10 @@
|
|||||||
|
|
||||||
# coding=utf-8
|
# coding=utf-8
|
||||||
|
|
||||||
import os
|
|
||||||
import pytest
|
import pytest
|
||||||
import vcr
|
import vcr
|
||||||
from assertions import (
|
from assertions import (
|
||||||
assert_cassette_empty,
|
assert_cassette_empty,
|
||||||
assert_cassette_has_one_response,
|
|
||||||
assert_is_json
|
assert_is_json
|
||||||
)
|
)
|
||||||
certifi = pytest.importorskip("certifi")
|
certifi = pytest.importorskip("certifi")
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ class CassettePatcherBuilder(object):
|
|||||||
except ImportError: # pragma: no cover
|
except ImportError: # pragma: no cover
|
||||||
return ()
|
return ()
|
||||||
from .stubs import requests_stubs
|
from .stubs import requests_stubs
|
||||||
return self._mock_urllib3_triples(cpool, requests_stubs)
|
return self._urllib3_patchers(cpool, requests_stubs)
|
||||||
|
|
||||||
def _patched_get_conn(self, connection_pool_class, connection_class_getter):
|
def _patched_get_conn(self, connection_pool_class, connection_class_getter):
|
||||||
get_conn = connection_pool_class._get_conn
|
get_conn = connection_pool_class._get_conn
|
||||||
@@ -166,9 +166,9 @@ class CassettePatcherBuilder(object):
|
|||||||
try:
|
try:
|
||||||
import urllib3.connectionpool as cpool
|
import urllib3.connectionpool as cpool
|
||||||
except ImportError: # pragma: no cover
|
except ImportError: # pragma: no cover
|
||||||
pass
|
return ()
|
||||||
from .stubs import urllib3_stubs
|
from .stubs import urllib3_stubs
|
||||||
return self._mock_urllib3_triples(cpool, urllib3_stubs)
|
return self._urllib3_patchers(cpool, urllib3_stubs)
|
||||||
|
|
||||||
@_build_patchers_from_mock_triples_decorator
|
@_build_patchers_from_mock_triples_decorator
|
||||||
def _httplib2(self):
|
def _httplib2(self):
|
||||||
@@ -195,7 +195,7 @@ class CassettePatcherBuilder(object):
|
|||||||
from .stubs.boto_stubs import VCRCertValidatingHTTPSConnection
|
from .stubs.boto_stubs import VCRCertValidatingHTTPSConnection
|
||||||
yield cpool, 'CertValidatingHTTPSConnection', VCRCertValidatingHTTPSConnection
|
yield cpool, 'CertValidatingHTTPSConnection', VCRCertValidatingHTTPSConnection
|
||||||
|
|
||||||
def _mock_urllib3_triples(self, cpool, stubs):
|
def _urllib3_patchers(self, cpool, stubs):
|
||||||
http_connection_remover = ConnectionRemover(
|
http_connection_remover = ConnectionRemover(
|
||||||
self._get_cassette_subclass(stubs.VCRRequestsHTTPConnection)
|
self._get_cassette_subclass(stubs.VCRRequestsHTTPConnection)
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user