1616 "httpx_client" ,
1717 (httpx .Client (), httpx .AsyncClient ()),
1818)
19- def test_crumb_capture_and_hint (sentry_init , capture_events , httpx_client ):
19+ def test_crumb_capture_and_hint (sentry_init , capture_events , httpx_client , httpx_mock ):
20+ httpx_mock .add_response ()
21+
2022 def before_breadcrumb (crumb , hint ):
2123 crumb ["data" ]["extra" ] = "foo"
2224 return crumb
2325
2426 sentry_init (integrations = [HttpxIntegration ()], before_breadcrumb = before_breadcrumb )
2527
2628 url = "http://example.com/"
27- responses .add (responses .GET , url , status = 200 )
2829
2930 with start_span ():
3031 events = capture_events ()
@@ -61,7 +62,9 @@ def before_breadcrumb(crumb, hint):
6162 "httpx_client" ,
6263 (httpx .Client (), httpx .AsyncClient ()),
6364)
64- def test_outgoing_trace_headers (sentry_init , httpx_client , capture_envelopes ):
65+ def test_outgoing_trace_headers (sentry_init , httpx_client , capture_envelopes , httpx_mock ):
66+ httpx_mock .add_response ()
67+
6568 sentry_init (
6669 traces_sample_rate = 1.0 ,
6770 integrations = [HttpxIntegration ()],
@@ -70,7 +73,6 @@ def test_outgoing_trace_headers(sentry_init, httpx_client, capture_envelopes):
7073 envelopes = capture_envelopes ()
7174
7275 url = "http://example.com/"
73- responses .add (responses .GET , url , status = 200 )
7476
7577 with start_span (
7678 name = "/interactions/other-dogs/new-dog" ,
@@ -104,7 +106,10 @@ def test_outgoing_trace_headers_append_to_baggage(
104106 sentry_init ,
105107 httpx_client ,
106108 capture_envelopes ,
109+ httpx_mock ,
107110):
111+ httpx_mock .add_response ()
112+
108113 sentry_init (
109114 traces_sample_rate = 1.0 ,
110115 integrations = [HttpxIntegration ()],
@@ -114,7 +119,6 @@ def test_outgoing_trace_headers_append_to_baggage(
114119 envelopes = capture_envelopes ()
115120
116121 url = "http://example.com/"
117- responses .add (responses .GET , url , status = 200 )
118122
119123 with start_span (
120124 name = "/interactions/other-dogs/new-dog" ,
@@ -306,12 +310,13 @@ def test_propagates_twp_outside_root_span(sentry_init, httpx_mock):
306310
307311
308312@pytest .mark .tests_internal_exceptions
309- def test_omit_url_data_if_parsing_fails (sentry_init , capture_events ):
313+ def test_omit_url_data_if_parsing_fails (sentry_init , capture_events , httpx_mock ):
314+ httpx_mock .add_response ()
315+
310316 sentry_init (integrations = [HttpxIntegration ()])
311317
312318 httpx_client = httpx .Client ()
313319 url = "http://example.com"
314- responses .add (responses .GET , url , status = 200 )
315320
316321 events = capture_events ()
317322 with mock .patch (
@@ -342,7 +347,9 @@ def test_omit_url_data_if_parsing_fails(sentry_init, capture_events):
342347 "httpx_client" ,
343348 (httpx .Client (), httpx .AsyncClient ()),
344349)
345- def test_span_origin (sentry_init , capture_events , httpx_client ):
350+ def test_span_origin (sentry_init , capture_events , httpx_client , httpx_mock ):
351+ httpx_mock .add_response ()
352+
346353 sentry_init (
347354 integrations = [HttpxIntegration ()],
348355 traces_sample_rate = 1.0 ,
@@ -351,7 +358,6 @@ def test_span_origin(sentry_init, capture_events, httpx_client):
351358 events = capture_events ()
352359
353360 url = "http://example.com/"
354- responses .add (responses .GET , url , status = 200 )
355361
356362 with start_span (name = "test_root_span" ):
357363 if asyncio .iscoroutinefunction (httpx_client .get ):
0 commit comments