@@ -169,13 +169,13 @@ def test_configure_service_name_env():
169169
170170 async def test ():
171171 token = "tests.contrib.httpx.test_httpx.test_configure_service_name_env"
172- with snapshot_context (token = token ):
172+ with snapshot_context (wait_for_num_traces = 1 , token = token ):
173173 DEFAULT_HEADERS = {
174174 "User-Agent" : "python-httpx/x.xx.x" ,
175175 }
176176 httpx .get (url , headers = DEFAULT_HEADERS )
177177
178- with snapshot_context (token = token ):
178+ with snapshot_context (wait_for_num_traces = 1 , token = token ):
179179 async with httpx .AsyncClient () as client :
180180 DEFAULT_HEADERS = {
181181 "User-Agent" : "python-httpx/x.xx.x" ,
@@ -209,13 +209,13 @@ def test_configure_global_service_name_env():
209209
210210 async def test ():
211211 token = "tests.contrib.httpx.test_httpx.test_configure_global_service_name_env"
212- with snapshot_context (token = token ):
212+ with snapshot_context (wait_for_num_traces = 1 , token = token ):
213213 DEFAULT_HEADERS = {
214214 "User-Agent" : "python-httpx/x.xx.x" ,
215215 }
216216 httpx .get (url , headers = DEFAULT_HEADERS )
217217
218- with snapshot_context (token = token ):
218+ with snapshot_context (wait_for_num_traces = 1 , token = token ):
219219 async with httpx .AsyncClient () as client :
220220 await client .get (url , headers = DEFAULT_HEADERS )
221221
@@ -232,11 +232,11 @@ async def test_get_500(snapshot_context):
232232 We mark the span as an error
233233 """
234234 url = get_url ("/status/500" )
235- with snapshot_context ():
235+ with snapshot_context (wait_for_num_traces = 1 ):
236236 resp = httpx .get (url , headers = DEFAULT_HEADERS )
237237 assert resp .status_code == 500
238238
239- with snapshot_context ():
239+ with snapshot_context (wait_for_num_traces = 1 ):
240240 async with httpx .AsyncClient () as client :
241241 resp = await client .get (url , headers = DEFAULT_HEADERS )
242242 assert resp .status_code == 500
@@ -245,17 +245,17 @@ async def test_get_500(snapshot_context):
245245@pytest .mark .asyncio
246246async def test_split_by_domain (snapshot_context ):
247247 """
248- When split_by_domain is configure
248+ When split_by_domain is configured
249249 We set the service name to the <host>:<port>
250250 """
251251 url = get_url ("/status/200" )
252252
253253 with override_config ("httpx" , {"split_by_domain" : True }):
254- with snapshot_context ():
254+ with snapshot_context (wait_for_num_traces = 1 ):
255255 resp = httpx .get (url , headers = DEFAULT_HEADERS )
256256 assert resp .status_code == 200
257257
258- with snapshot_context ():
258+ with snapshot_context (wait_for_num_traces = 1 ):
259259 async with httpx .AsyncClient () as client :
260260 resp = await client .get (url , headers = DEFAULT_HEADERS )
261261 assert resp .status_code == 200
@@ -275,11 +275,11 @@ async def test_trace_query_string(snapshot_context):
275275 "User-Agent" : "python-httpx/x.xx.x" ,
276276 }
277277 with override_http_config ("httpx" , {"trace_query_string" : True }):
278- with snapshot_context ():
278+ with snapshot_context (wait_for_num_traces = 1 ):
279279 resp = httpx .get (url , headers = headers )
280280 assert resp .status_code == 200
281281
282- with snapshot_context ():
282+ with snapshot_context (wait_for_num_traces = 1 ):
283283 async with httpx .AsyncClient () as client :
284284 resp = await client .get (url , headers = headers )
285285 assert resp .status_code == 200
@@ -300,11 +300,11 @@ async def test_request_headers(snapshot_context):
300300
301301 try :
302302 config .httpx .http .trace_headers (["Some-Request-Header" , "Some-Response-Header" ])
303- with snapshot_context ():
303+ with snapshot_context (wait_for_num_traces = 1 ):
304304 resp = httpx .get (url , headers = headers )
305305 assert resp .status_code == 200
306306
307- with snapshot_context ():
307+ with snapshot_context (wait_for_num_traces = 1 ):
308308 async with httpx .AsyncClient () as client :
309309 resp = await client .get (url , headers = headers )
310310 assert resp .status_code == 200
0 commit comments