Skip to content

Commit f76528f

Browse files
authored
Fixed flaky test (#4165)
The URL www.squirrelchasers.com is actually existing, so we should not access it in our tests. Hope this make the test more stable.
1 parent eb189ef commit f76528f

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

tests/integrations/stdlib/test_httplib.py

+8-17
Original file line numberDiff line numberDiff line change
@@ -398,25 +398,16 @@ def test_http_timeout(monkeypatch, sentry_init, capture_envelopes):
398398

399399
envelopes = capture_envelopes()
400400

401-
with start_transaction(op="op", name="name"):
402-
try:
403-
conn = HTTPSConnection("www.squirrelchasers.com")
404-
conn.request("GET", "/top-chasers")
401+
with pytest.raises(TimeoutError):
402+
with start_transaction(op="op", name="name"):
403+
conn = HTTPSConnection("www.example.com")
404+
conn.request("GET", "/bla")
405405
conn.getresponse()
406-
except Exception:
407-
pass
408-
409-
items = [
410-
item
411-
for envelope in envelopes
412-
for item in envelope.items
413-
if item.type == "transaction"
414-
]
415-
assert len(items) == 1
416-
417-
transaction = items[0].payload.json
406+
407+
(transaction_envelope,) = envelopes
408+
transaction = transaction_envelope.get_transaction_event()
418409
assert len(transaction["spans"]) == 1
419410

420411
span = transaction["spans"][0]
421412
assert span["op"] == "http.client"
422-
assert span["description"] == "GET https://www.squirrelchasers.com/top-chasers"
413+
assert span["description"] == "GET https://www.example.com/bla"

0 commit comments

Comments
 (0)