@@ -303,7 +303,14 @@ def test_dictionary(self):
303303 ref_kdic = os .path .join (ref_kdic_dir , f"{ dictionary } .kdic" )
304304 ref_kdicj = os .path .join (ref_kdicj_dir , f"{ dictionary } .kdicj" )
305305 output_kdic = os .path .join (output_kdic_dir , f"{ dictionary } .kdic" )
306+ output_kdic_new_dir = os .path .join (output_kdic_dir , "missing_folder" )
307+
308+ # Cleanup the previous `output_kdic_new_dir` folder (if it exists)
309+ shutil .rmtree (output_kdic_new_dir , ignore_errors = True )
310+
311+ self .assertFalse (os .path .exists (output_kdic_new_dir ))
306312 copy_output_kdic = os .path .join (copy_output_kdic_dir , f"{ dictionary } .kdic" )
313+
307314 with self .subTest (dictionary = dictionary ):
308315 if dictionary in dictionaries_warn :
309316 with self .assertWarns (UserWarning ):
@@ -312,6 +319,11 @@ def test_dictionary(self):
312319 domain = kh .read_dictionary_file (ref_kdicj )
313320 domain .export_khiops_dictionary_file (output_kdic )
314321 assert_files_equal (self , ref_kdic , output_kdic )
322+ domain .export_khiops_dictionary_file (
323+ os .path .join (output_kdic_new_dir , f"{ dictionary } .kdic" )
324+ )
325+ # Ensure a missing parent directory is created automatically
326+ self .assertTrue (os .path .exists (output_kdic_new_dir ))
315327
316328 domain_copy = domain .copy ()
317329 domain_copy .export_khiops_dictionary_file (copy_output_kdic )
0 commit comments