72
72
r'^OK \((failures=(?P<failures>\d+))?(, )?(errors=(?P<errors>\d+))?(, )?(skipped=(?P<skipped>\d+))?\)$' )
73
73
PTRN_JAVA_EXCEPTION = re .compile (r'^(?P<exception>com\.oracle\.[^:]*):(?P<message>.*)' )
74
74
PTRN_MODULE_NOT_FOUND = re .compile (r'.*ModuleNotFound: \'(?P<module>.*)\'\..*' , re .DOTALL )
75
-
75
+ PTRN_IMPORT_ERROR = re . compile ( r".*cannot import name \'(?P<module>.*)\'.*" , re . DOTALL )
76
76
77
77
# ----------------------------------------------------------------------------------------------------------------------
78
78
#
@@ -279,11 +279,14 @@ def process_output(output_lines):
279
279
# python error processing
280
280
#
281
281
# ----------------------------------------------------------------------------------------------------------------------
282
- def process_errors (unittests , error_messages , error = None , msg_processor = None ):
282
+ def process_errors (unittests , error_messages , err = None , msg_processor = None ):
283
+ if isinstance (err , str ):
284
+ err = {err ,}
285
+
283
286
def _err_filter (item ):
284
- if not error :
287
+ if not err :
285
288
return True
286
- return item [0 ] == error
289
+ return item [0 ] in err
287
290
288
291
def _processor (msg ):
289
292
if not msg_processor :
@@ -304,6 +307,11 @@ def get_missing_module(msg):
304
307
return match .group ('module' ) if match else None
305
308
306
309
310
+ def get_cannot_import_module (msg ):
311
+ match = re .match (PTRN_IMPORT_ERROR , msg )
312
+ return match .group ('module' ) if match else None
313
+
314
+
307
315
# ----------------------------------------------------------------------------------------------------------------------
308
316
#
309
317
# csv reporting
@@ -499,7 +507,7 @@ def save_as_csv(report_path, unittests, error_messages, java_exceptions, stats):
499
507
'''
500
508
501
509
502
- def save_as_html (report_name , rows , totals , missing_modules , java_issues , current_date ):
510
+ def save_as_html (report_name , rows , totals , missing_modules , cannot_import_modules , java_issues , current_date ):
503
511
def grid (* components ):
504
512
def _fmt (cmp ):
505
513
if isinstance (cmp , tuple ):
@@ -601,6 +609,11 @@ def format_val(row, k):
601
609
for cnt , name in sorted (((cnt , name ) for name , cnt in missing_modules .items ()), reverse = True )
602
610
])
603
611
612
+ cannot_import_modules_info = ul ('modules which could not be imported' , [
613
+ '<b>{}</b> <span class="text-muted">could not be imported by {} unittests</span>' .format (name , cnt )
614
+ for cnt , name in sorted (((cnt , name ) for name , cnt in cannot_import_modules .items ()), reverse = True )
615
+ ])
616
+
604
617
java_issues_info = ul ('Java issues' , [
605
618
'<b>{}</b> <span class="text-muted">caused by {} unittests</span>' .format (name , cnt )
606
619
for cnt , name in sorted (((cnt , name ) for name , cnt in java_issues .items ()), reverse = True )
@@ -619,7 +632,10 @@ def format_val(row, k):
619
632
620
633
table_stats = table ('stats' , CSV_HEADER , rows )
621
634
622
- content = ' <br> ' .join ([total_stats_info , table_stats , missing_modules_info , java_issues_info ])
635
+ content = ' <br> ' .join ([total_stats_info , table_stats ,
636
+ missing_modules_info ,
637
+ cannot_import_modules_info ,
638
+ java_issues_info ])
623
639
624
640
report = HTML_TEMPLATE .format (
625
641
title = 'GraalPython Unittests Stats' ,
@@ -688,15 +704,19 @@ def _fmt(t):
688
704
csv_report_path = file_name (CSV_RESULTS_NAME , current_date )
689
705
rows , totals = save_as_csv (csv_report_path , unittests , error_messages , java_exceptions , stats )
690
706
691
- missing_modules = process_errors (unittests , error_messages , error = 'ModuleNotFoundError' ,
707
+ missing_modules = process_errors (unittests , error_messages , 'ModuleNotFoundError' ,
692
708
msg_processor = get_missing_module )
693
709
log ("[MISSING MODULES] \n {}" , pformat (dict (missing_modules )))
694
710
711
+ cannot_import_modules = process_errors (unittests , error_messages , err = 'ImportError' ,
712
+ msg_processor = get_cannot_import_module )
713
+ log ("[CANNOT IMPORT MODULES] \n {}" , pformat (dict (cannot_import_modules )))
714
+
695
715
java_issues = process_errors (unittests , java_exceptions )
696
716
log ("[JAVA ISSUES] \n {}" , pformat (dict (java_issues )))
697
717
698
718
html_report_path = file_name (HTML_RESULTS_NAME , current_date )
699
- save_as_html (html_report_path , rows , totals , missing_modules , java_issues , current_date )
719
+ save_as_html (html_report_path , rows , totals , missing_modules , cannot_import_modules , java_issues , current_date )
700
720
701
721
if flags .path :
702
722
log ("[SAVE] saving results to {} ... " , flags .path )
0 commit comments