@@ -49,7 +49,7 @@ def _only_arming_warning(err: str) -> bool:
4949 harness would otherwise reject as unexpected stderr. Runs in the parent test
5050 process against the subprocess's decoded stderr.
5151 """
52- lines = [line for line in err .splitlines () if line .strip ()]
52+ lines : list [ str ] = [line for line in err .splitlines () if line .strip ()]
5353 return all ("native heap ownership partition:" in line for line in lines )
5454
5555
@@ -248,24 +248,24 @@ def test_profiler_start_emits_partition_armed_gauge_when_armed() -> None:
248248
249249 profiling_config .native_heap .enabled = True # pyright: ignore[reportAttributeAccessIssue]
250250
251- client = mock .Mock ()
251+ client : mock . Mock = mock .Mock ()
252252 with mock .patch .object (heap_gotter , "install" , return_value = True ):
253253 with mock .patch .object (heap_gotter , "live_heap_enabled" , return_value = False ):
254254 with mock .patch .object (ddtrace .internal .dogstatsd , "get_dogstatsd_client" , return_value = client ):
255255 with mock .patch .object (profiler_mod .LOG , "warning" ) as warning :
256- prof = profiler_mod .Profiler ()
256+ prof : profiler_mod . Profiler = profiler_mod .Profiler ()
257257 prof .start ()
258258 try :
259259 assert client .gauge .call_count == 1
260260 args , kwargs = client .gauge .call_args
261261 assert args [0 ] == "profiling.native_heap.partition_armed"
262262 assert args [1 ] == 1 , "gauge value must be 1 when armed"
263- tags = kwargs ["tags" ]
263+ tags : list [ str ] = kwargs ["tags" ]
264264 assert "domains:OBJ_MEM" in tags
265265 assert "size_threshold_bytes:512" in tags
266266
267267 assert warning .called , "arming decision must be logged at WARNING"
268- msg = warning .call_args [0 ][0 ]
268+ msg : str = warning .call_args [0 ][0 ]
269269 assert "native heap ownership partition" in msg
270270 assert warning .call_args [0 ][1 ] is True , "WARNING must report armed=True"
271271 finally :
@@ -286,11 +286,11 @@ def test_profiler_start_emits_partition_armed_gauge_zero_when_not_armed() -> Non
286286
287287 profiling_config .native_heap .enabled = True # pyright: ignore[reportAttributeAccessIssue]
288288
289- client = mock .Mock ()
289+ client : mock . Mock = mock .Mock ()
290290 with mock .patch .object (heap_gotter , "install" , return_value = False ):
291291 with mock .patch .object (ddtrace .internal .dogstatsd , "get_dogstatsd_client" , return_value = client ):
292292 with mock .patch .object (profiler_mod .LOG , "warning" ) as warning :
293- prof = profiler_mod .Profiler ()
293+ prof : profiler_mod . Profiler = profiler_mod .Profiler ()
294294 prof .start ()
295295 try :
296296 assert client .gauge .call_count == 1
@@ -322,7 +322,7 @@ def test_profiler_start_survives_partition_armed_gauge_error() -> None:
322322 with mock .patch .object (
323323 ddtrace .internal .dogstatsd , "get_dogstatsd_client" , side_effect = RuntimeError ("no agent" )
324324 ):
325- prof = profiler_mod .Profiler ()
325+ prof : profiler_mod . Profiler = profiler_mod .Profiler ()
326326 prof .start () # must not raise
327327 try :
328328 assert prof .status .value == "running"
0 commit comments