3838#
3939
4040
41- def _ts_to_iso (ts : Optional [float ]) -> Optional [str ]:
41+ def _timestamp_to_iso (ts : Optional [float ]) -> Optional [str ]:
4242 # convert to ISO-8601 formatted date
4343 if ts is None :
4444 return None
@@ -336,22 +336,22 @@ def parse_func(
336336 props = None
337337
338338 # extract raw timestamps
339- start_ts = data .get ("start" )
340- stop_ts = data .get ("stop" )
339+ start_timestamp = data .get ("start" )
340+ stop_timestamp = data .get ("stop" )
341341
342342 # convert to ISO-8601
343- start_iso = _ts_to_iso ( start_ts )
344- stop_iso = _ts_to_iso ( stop_ts )
343+ start_timestamp_iso_format = _timestamp_to_iso ( start_timestamp )
344+ end_timestamp_iso_format = _timestamp_to_iso ( stop_timestamp )
345345
346346 print (
347- f"DEBUG pytest timing start={ start_iso } , stop={ stop_iso } "
347+ f"DEBUG pytest timing start={ start_timestamp_iso_format } , stop={ end_timestamp_iso_format } "
348348 )
349349
350350 event_data = {}
351- if start_iso :
352- event_data ["start_timestamp" ] = start_iso
353- if stop_iso :
354- event_data ["stop_timestamp" ] = stop_iso
351+ if start_timestamp_iso_format :
352+ event_data ["start_timestamp" ] = start_timestamp_iso_format
353+ if end_timestamp_iso_format :
354+ event_data ["stop_timestamp" ] = end_timestamp_iso_format
355355
356356 test_path = _parse_pytest_nodeid (nodeid )
357357 for path in test_path :
@@ -360,13 +360,14 @@ def parse_func(
360360
361361 data_payload = event_data if event_data else None
362362
363- # stop_iso is being passed as timestamp as it reflects event finalization (start + duration = stop)
363+ # end_timestamp_iso_format is being passed as timestamp as it reflects event finalization
364+ # start + duration = stop
364365 # sending both start and stop time in the event data field
365366 yield CaseEvent .create (
366367 test_path = test_path ,
367368 duration_secs = data .get ("duration" , 0 ),
368369 status = status ,
369370 stdout = stdout ,
370371 stderr = stderr ,
371- timestamp = stop_iso ,
372+ timestamp = end_timestamp_iso_format ,
372373 data = data_payload )
0 commit comments