@@ -153,6 +153,22 @@ def csv_rtol(self):
153153 def csv_rtol (self , val ):
154154 self ._csv_rtol = val
155155
156+ @property
157+ def csv_comment_diff_fn (self ): # -> Any | Callable[..., None]:
158+ return getattr (self , '_csv_comment_diff_fn' , None )
159+
160+ @csv_comment_diff_fn .setter
161+ def csv_comment_diff_fn (self , test_fn ):
162+ self ._csv_comment_diff_fn = test_fn
163+
164+ @property
165+ def csv_comment_str (self ):
166+ return getattr (self , '_csv_comment_str' , '#' )
167+
168+ @csv_comment_str .setter
169+ def csv_comment_str (self , comment_str ):
170+ self ._csv_comment_str = comment_str
171+
156172 def post_test_hook (self , test : str , spec : TestSpec , backend : str ) -> None :
157173 """Function callback ran after each test case
158174
@@ -624,16 +640,16 @@ def run_test(index: int, test: str, spec: TestSpec, backend: str,
624640 category = spec .name ,)
625641 ref_csvs : List [Path ] = []
626642 ref_ascii : List [Path ] = []
627- output_files : List [str ] = [arg for arg in run_args if 'ascii:' in arg ]
643+ output_files : List [str ] = [arg . split ( ':' )[ 1 ] for arg in run_args if arg . startswith ( 'ascii:' ) ]
628644 if output_files :
629- ref_csvs = [suite_spec .get_output_path (test , file . split ( ':' )[ 1 ] )
645+ ref_csvs = [suite_spec .get_output_path (test , file )
630646 for file in output_files if file .endswith ('.csv' )]
631- ref_ascii = [suite_spec .get_output_path (test , file . split ( ':' )[ 1 ] )
647+ ref_ascii = [suite_spec .get_output_path (test , file )
632648 for file in output_files if not file .endswith ('.csv' )]
633649 ref_cgns : List [Path ] = []
634- output_files = [arg for arg in run_args if 'cgns:' in arg ]
650+ output_files = [arg . split ( ':' )[ 1 ] for arg in run_args if arg . startswith ( 'cgns:' ) ]
635651 if output_files :
636- ref_cgns = [suite_spec .get_output_path (test , file . split ( 'cgns:' )[ - 1 ] ) for file in output_files ]
652+ ref_cgns = [suite_spec .get_output_path (test , file ) for file in output_files ]
637653 ref_stdout : Path = suite_spec .get_output_path (test , test + '.out' )
638654 suite_spec .post_test_hook (test , spec , backend )
639655
@@ -681,7 +697,13 @@ def run_test(index: int, test: str, spec: TestSpec, backend: str,
681697 else :
682698 csv_ztol : float = spec .csv_ztol if spec .csv_ztol > 0 else suite_spec .csv_ztol
683699 csv_rtol : float = spec .csv_rtol if spec .csv_rtol > 0 else suite_spec .csv_rtol
684- diff = diff_csv (out_file , ref_csv , zero_tol = csv_ztol , rel_tol = csv_rtol )
700+ diff = diff_csv (
701+ out_file ,
702+ ref_csv ,
703+ csv_ztol ,
704+ csv_rtol ,
705+ suite_spec .csv_comment_str ,
706+ suite_spec .csv_comment_diff_fn )
685707 if diff :
686708 save_path : Path = suite_spec .test_failure_artifacts_path / csv_name
687709 shutil .move (out_file , save_path )
0 commit comments