@@ -271,22 +271,53 @@ def create_pipeline_kwargs(test_model_param, subset_size, test_case_name, refere
271
271
}
272
272
273
273
274
- def _update_status (pipeline : BaseTestPipeline , errors : List [ErrorReason ]) -> List [str ]:
274
+ def _get_exception_type_name (report : ErrorReport ) -> str :
275
+ return report .msg .split ("|" )[0 ].replace ("Exception Type: " , "" )
276
+
277
+
278
+ def _get_exception_error_message (report : ErrorReport ) -> str :
279
+ return report .msg .split ("|" )[1 ]
280
+
281
+
282
+ def _are_exceptions_matched (report : ErrorReport , reference_exception : Dict [str , str ]) -> bool :
283
+ return reference_exception ["error_message" ] == _get_exception_error_message (report ) and reference_exception [
284
+ "type"
285
+ ] == _get_exception_type_name (report )
286
+
287
+
288
+ def _is_error_xfailed (report : ErrorReport , xfail_reason : str , reference_data : Dict [str , Dict [str , str ]]) -> bool :
289
+ if xfail_reason not in reference_data :
290
+ return False
291
+
292
+ if report .reason == ErrorReason .EXCEPTION :
293
+ return _are_exceptions_matched (report , reference_data [xfail_reason ])
294
+ return True
295
+
296
+
297
+ def _get_xfail_message (report : ErrorReport , xfail_reason : str , reference_data : Dict [str , Dict [str , str ]]) -> str :
298
+ if report .reason == ErrorReason .EXCEPTION :
299
+ return f"XFAIL: { reference_data [xfail_reason ]['message' ]} - { report .msg } "
300
+ return f"XFAIL: { xfail_reason } - { report .msg } "
301
+
302
+
303
+ def _update_status (pipeline : BaseTestPipeline , error_reports : List [ErrorReport ]) -> List [str ]:
275
304
"""
276
305
Updates status of the pipeline based on the errors encountered during the run.
277
306
278
307
:param pipeline: The pipeline object containing run information.
279
- :param errors : List of errors encountered during the run.
308
+ :param error_reports : List of errors encountered during the run.
280
309
:return: List of unexpected errors.
281
310
"""
282
311
pipeline .run_info .status = "" # Successful status
283
312
xfails , unexpected_errors = [], []
284
- for report in errors :
313
+
314
+ for report in error_reports :
285
315
xfail_reason = report .reason .value + XFAIL_SUFFIX
286
- if xfail_reason in pipeline .reference_data :
287
- xfails .append (f"XFAIL: { pipeline . reference_data [ xfail_reason ] } - { report . msg } " )
316
+ if _is_error_xfailed ( report , xfail_reason , pipeline .reference_data ) :
317
+ xfails .append (_get_xfail_message ( report , xfail_reason , pipeline . reference_data ) )
288
318
else :
289
319
unexpected_errors .append (report .msg )
320
+
290
321
if xfails :
291
322
pipeline .run_info .status = "\n " .join (xfails )
292
323
if unexpected_errors :
@@ -408,10 +439,8 @@ def run_pipeline(
408
439
try :
409
440
pipeline .run ()
410
441
except Exception as e :
411
- err_msg = str (e )
412
- if not err_msg :
413
- err_msg = "Unknown exception"
414
- exception_report = ErrorReport (ErrorReason .EXCEPTION , err_msg )
442
+ message = f"Exception Type: { type (e ).__name__ } |{ str (e )} "
443
+ exception_report = ErrorReport (ErrorReason .EXCEPTION , message )
415
444
traceback .print_exc ()
416
445
finally :
417
446
if pipeline is not None :
@@ -424,7 +453,7 @@ def run_pipeline(
424
453
if extra_columns :
425
454
pipeline .collect_data_from_stdout (captured .out )
426
455
else :
427
- run_info = create_short_run_info (test_model_param , err_msg , test_case_name )
456
+ run_info = create_short_run_info (test_model_param , message , test_case_name )
428
457
run_info .time_total = time .perf_counter () - start_time
429
458
430
459
errors = _collect_errors (pipeline , exception_report )
0 commit comments