File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -360,11 +360,12 @@ def test_cmorisation_variable(
360360 output_dir = (
361361 Path (gettempdir ()) / f"cmor_output_{ compound_table } _{ variable_name } "
362362 )
363+ drs_enabled = compliance_validation_tool == "wcrp"
363364
364365 # Ensure output directory exists and is clean
365366 output_dir .mkdir (parents = True , exist_ok = True )
366- for f in output_dir .glob ("*.nc" ):
367- f .unlink ()
367+ for f in output_dir .rglob ("*.nc" ):
368+ f .unlink (missing_ok = True )
368369
369370 with _get_cmor_table_path (cmip_version , cmor_table_file ) as table_path :
370371 try :
@@ -379,6 +380,7 @@ def test_cmorisation_variable(
379380 activity_id = "CMIP" ,
380381 parent_info = parent_info ,
381382 output_path = output_dir ,
383+ drs_root = output_dir if drs_enabled else None ,
382384 )
383385
384386 cmoriser .run ()
@@ -388,7 +390,7 @@ def test_cmorisation_variable(
388390 # filename template from CMIP6, so assert on written NetCDF
389391 # files in the dedicated per-variable output directory rather
390392 # than a CMIP6-specific filename pattern.
391- output_files = sorted (output_dir .glob ("*.nc" ))
393+ output_files = sorted (output_dir .rglob ("*.nc" ))
392394 assert (
393395 output_files
394396 ), f"No output files found for { variable_name } in { output_dir } "
You can’t perform that action at this time.
0 commit comments