Skip to content

Commit 14fac32

Browse files
committed
.
1 parent dd9c62b commit 14fac32

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tests/test_transport.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from unittest import mock
1111

1212
import brotli
13+
import httpcore
1314
import pytest
1415
from pytest_localserver.http import WSGIServer
1516
from werkzeug.wrappers import Request, Response
@@ -282,6 +283,30 @@ def test_default_timeout(make_client):
282283
assert options["timeout"].total == client.transport.TIMEOUT
283284

284285

286+
@pytest.mark.skipif(not PY38, reason="HTTP2 libraries are only available in py3.8+")
287+
def test_default_timeout_http2(make_client):
288+
client = make_client(_experiments={"transport_http2": True})
289+
290+
with mock.patch(
291+
"sentry_sdk.transport.httpcore.ConnectionPool.request",
292+
return_value=httpcore.Response(200),
293+
) as request_mock:
294+
sentry_sdk.get_global_scope().set_client(client)
295+
capture_message("hi")
296+
client.flush()
297+
298+
request_mock.assert_called_once()
299+
assert request_mock.call_args.kwargs["extensions"] == {
300+
"timeout": {
301+
"pool": client.transport.TIMEOUT,
302+
"connect": client.transport.TIMEOUT,
303+
"write": client.transport.TIMEOUT,
304+
"read": client.transport.TIMEOUT,
305+
}
306+
}
307+
sentry_sdk.get_global_scope().set_client(None)
308+
309+
285310
@pytest.mark.skipif(not PY38, reason="HTTP2 libraries are only available in py3.8+")
286311
def test_http2_with_https_dsn(make_client):
287312
client = make_client(_experiments={"transport_http2": True})

0 commit comments

Comments
 (0)