Support missing SNIMissingWarning in tests (#6336)

This commit is contained in:
Quentin Pradet
2023-01-21 09:44:33 +01:00
committed by GitHub
parent 16a17a3ca7
commit 15585909c3
2 changed files with 14 additions and 5 deletions
+9 -5
View File
@@ -2,9 +2,13 @@
import warnings
from urllib3.exceptions import SNIMissingWarning
try:
from urllib3.exceptions import SNIMissingWarning
# urllib3 sets SNIMissingWarning to only go off once,
# while this test suite requires it to always fire
# so that it occurs during test_requests.test_https_warnings
warnings.simplefilter("always", SNIMissingWarning)
# urllib3 1.x sets SNIMissingWarning to only go off once,
# while this test suite requires it to always fire
# so that it occurs during test_requests.test_https_warnings
warnings.simplefilter("always", SNIMissingWarning)
except ImportError:
# urllib3 2.0 removed that warning and errors out instead
SNIMissingWarning = None