Skip to content

Commit 60fc6fe

Browse files
committed
Merge branch 'potel-base' into ivana/potel/port-sample-rand
2 parents d0d6420 + e57798f commit 60fc6fe

File tree

1 file changed

+8
-19
lines changed

1 file changed

+8
-19
lines changed

tests/integrations/stdlib/test_httplib.py

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -388,27 +388,16 @@ def test_http_timeout(monkeypatch, sentry_init, capture_envelopes):
388388

389389
envelopes = capture_envelopes()
390390

391-
with start_span(op="op", name="name"):
392-
try:
393-
conn = HTTPConnection("localhost", PORT)
394-
conn.request("GET", "/top-chasers")
391+
with pytest.raises(TimeoutError):
392+
with start_span(op="op", name="name"):
393+
conn = HTTPSConnection("www.example.com")
394+
conn.request("GET", "/bla")
395395
conn.getresponse()
396-
except Exception:
397-
pass
398-
399-
items = [
400-
item
401-
for envelope in envelopes
402-
for item in envelope.items
403-
if item.type == "transaction"
404-
]
405-
assert len(items) == 1
406-
407-
transaction = items[0].payload.json
396+
397+
(transaction_envelope,) = envelopes
398+
transaction = transaction_envelope.get_transaction_event()
408399
assert len(transaction["spans"]) == 1
409400

410401
span = transaction["spans"][0]
411402
assert span["op"] == "http.client"
412-
assert (
413-
span["description"] == f"GET http://localhost:{PORT}/top-chasers" # noqa: E231
414-
)
403+
assert span["description"] == "GET https://www.example.com/bla"

0 commit comments

Comments
 (0)