File tree 2 files changed +14
-5
lines changed
2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import warnings
4
4
5
- from urllib3 .exceptions import SNIMissingWarning
5
+ try :
6
+ from urllib3 .exceptions import SNIMissingWarning
6
7
7
- # urllib3 sets SNIMissingWarning to only go off once,
8
- # while this test suite requires it to always fire
9
- # so that it occurs during test_requests.test_https_warnings
10
- warnings .simplefilter ("always" , SNIMissingWarning )
8
+ # urllib3 1.x sets SNIMissingWarning to only go off once,
9
+ # while this test suite requires it to always fire
10
+ # so that it occurs during test_requests.test_https_warnings
11
+ warnings .simplefilter ("always" , SNIMissingWarning )
12
+ except ImportError :
13
+ # urllib3 2.0 removed that warning and errors out instead
14
+ SNIMissingWarning = None
Original file line number Diff line number Diff line change 48
48
from requests .sessions import SessionRedirectMixin
49
49
from requests .structures import CaseInsensitiveDict
50
50
51
+ from . import SNIMissingWarning
51
52
from .compat import StringIO
52
53
from .utils import override_environ
53
54
@@ -974,6 +975,10 @@ def test_http_with_certificate(self, httpbin):
974
975
r = requests .get (httpbin (), cert = "." )
975
976
assert r .status_code == 200
976
977
978
+ @pytest .mark .skipif (
979
+ SNIMissingWarning is None ,
980
+ reason = "urllib3 2.0 removed that warning and errors out instead" ,
981
+ )
977
982
def test_https_warnings (self , nosan_server ):
978
983
"""warnings are emitted with requests.get"""
979
984
host , port , ca_bundle = nosan_server
You can’t perform that action at this time.
0 commit comments