Skip to content

Commit b8021d7

Browse files
disable ssl deprecation for min-deps test
1 parent f64179c commit b8021d7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/test_httpserver.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,26 @@
1818
import warnings
1919

2020
import pytest
21+
import requests
22+
import urllib3
2123

2224
from elastic_transport import Transport
2325

2426

2527
@pytest.mark.parametrize("node_class", ["urllib3", "requests"])
2628
def test_simple_request(node_class, https_server_ip_node_config):
29+
# when testing minimum urllib3 and requests dependencies, we disable
30+
# the deprecation warning for ssl.match_hostname()
31+
silence_ssl_deprecation = (
32+
node_class == "urllib3" and urllib3.__version__ == "1.26.2"
33+
) or (node_class == "requests" and requests.__version__ == "2.26.0")
34+
2735
with warnings.catch_warnings():
2836
warnings.simplefilter("error")
37+
if silence_ssl_deprecation:
38+
warnings.filterwarnings(
39+
"ignore", ".*match_hostname.*deprecated", DeprecationWarning
40+
)
2941

3042
t = Transport([https_server_ip_node_config], node_class=node_class)
3143

0 commit comments

Comments
 (0)