Skip to content
Myr

Support missing SNIMissingWarning in tests (#6336)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Quentin Pradet · committed by GitHub · parent 16a17a3 · Browse files · 2 files+14 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+14 added−5 removed

  • tests:+14 added−5 removed

2 files+14 added−5 removed

modified:tests/__init__.py+9 added-5 removed
1"""Requests test package initialisation."""23import warnings45try:5from urllib3.exceptions import SNIMissingWarning6 from urllib3.exceptions import SNIMissingWarning77# urllib3 sets SNIMissingWarning to only go off once,8# while this test suite requires it to always fire9# so that it occurs during test_requests.test_https_warnings10warnings.simplefilter("always", SNIMissingWarning)8 # urllib3 1.x sets SNIMissingWarning to only go off once,9 # while this test suite requires it to always fire10 # so that it occurs during test_requests.test_https_warnings11 warnings.simplefilter("always", SNIMissingWarning)12except ImportError:13 # urllib3 2.0 removed that warning and errors out instead14 SNIMissingWarning = None
modified:tests/test_requests.py+5 added
46 unmodified lines
47from requests.models import PreparedRequest, urlencode48from requests.sessions import SessionRedirectMixin49from requests.structures import CaseInsensitiveDict5051from . import SNIMissingWarning52from .compat import StringIO53from .utils import override_environ5455# Requests to this URL should always fail with a connection timeout (nothing
918 unmodified lines
974 def test_http_with_certificate(self, httpbin):975 r = requests.get(httpbin(), cert=".")976 assert r.status_code == 200977978 @pytest.mark.skipif(979 SNIMissingWarning is None,980 reason="urllib3 2.0 removed that warning and errors out instead",981 )982 def test_https_warnings(self, nosan_server):983 """warnings are emitted with requests.get"""984 host, port, ca_bundle = nosan_server985 if HAS_MODERN_SSL or HAS_PYOPENSSL:
1780 unmodified lines