@@ -97,6 +97,15 @@ def get_output_path(self, test: str, output_file: str) -> Path:
97
97
"""
98
98
raise NotImplementedError
99
99
100
+ @property
101
+ def cgns_tol (self ):
102
+ """Absolute tolerance for CGNS diff"""
103
+ return getattr (self , '_cgns_tol' , 1.0e-12 )
104
+
105
+ @cgns_tol .setter
106
+ def cgns_tol (self , val ):
107
+ self ._cgns_tol = val
108
+
100
109
def post_test_hook (self , test : str , spec : TestSpec ) -> None :
101
110
"""Function callback ran after each test case
102
111
@@ -304,20 +313,20 @@ def diff_csv(test_csv: Path, true_csv: Path, zero_tol: float = 3e-10, rel_tol: f
304
313
return '\n ' .join (diff_lines )
305
314
306
315
307
- def diff_cgns (test_cgns : Path , true_cgns : Path , tolerance : float = 1e-12 ) -> str :
316
+ def diff_cgns (test_cgns : Path , true_cgns : Path , cgns_tol : float = 1e-12 ) -> str :
308
317
"""Compare CGNS results against an expected CGSN file with tolerance
309
318
310
319
Args:
311
320
test_cgns (Path): Path to output CGNS file
312
321
true_cgns (Path): Path to expected CGNS file
313
- tolerance (float, optional): Tolerance for comparing floating-point values
322
+ cgns_tol (float, optional): Tolerance for comparing floating-point values
314
323
315
324
Returns:
316
325
str: Diff output between result and expected CGNS files
317
326
"""
318
327
my_env : dict = os .environ .copy ()
319
328
320
- run_args : List [str ] = ['cgnsdiff' , '-d' , '-t' , f'{ tolerance } ' , str (test_cgns ), str (true_cgns )]
329
+ run_args : List [str ] = ['cgnsdiff' , '-d' , '-t' , f'{ cgns_tol } ' , str (test_cgns ), str (true_cgns )]
321
330
proc = subprocess .run (' ' .join (run_args ),
322
331
shell = True ,
323
332
stdout = subprocess .PIPE ,
@@ -487,7 +496,7 @@ def run_test(index: int, test: str, spec: TestSpec, backend: str,
487
496
if not ref_cgn .is_file ():
488
497
test_case .add_failure_info ('cgns' , output = f'{ ref_cgn } not found' )
489
498
else :
490
- diff = diff_cgns (Path .cwd () / cgn_name , ref_cgn )
499
+ diff = diff_cgns (Path .cwd () / cgn_name , ref_cgn , cgns_tol = suite_spec . cgns_tol )
491
500
if diff :
492
501
test_case .add_failure_info ('cgns' , output = diff )
493
502
else :
0 commit comments