@@ -78,15 +78,15 @@ def test_extra_key(min_config):
7878 ),
7979 (
8080 {"config_path" : "does_not_exist" },
81- "no such file or directory .*/does_not_exist " ,
81+ "No such file or directory" ,
8282 ),
8383 (
8484 {
8585 "install_templates" : [
8686 {"template" : "does_not_exist" , "output_file" : "not_relevant" }
8787 ]
8888 },
89- "No such file or directory .*/does_not_exist " ,
89+ "No such file or directory" ,
9090 ),
9191 (
9292 {"model" : {"realizations" : [- 1 ]}},
@@ -168,6 +168,47 @@ def test_invalid_subconfig(extra_config, min_config, expected):
168168 EverestConfig (** min_config )
169169
170170
171+ < << << << HEAD
172+ == == == =
173+ def test_that_config_directory_without_write_access_raises_validation_error (
174+ min_config , tmp_path
175+ ):
176+ tmp_path .mkdir (exist_ok = True )
177+ config_path = tmp_path / "config.yml"
178+ config_path .touch ()
179+ original_mode = tmp_path .stat ().st_mode
180+ tmp_path .chmod (0o555 )
181+ min_config ["config_path" ] = str (config_path )
182+
183+ try :
184+ with pytest .raises (ValidationError , match = f"'{ tmp_path } ' is not writeable" ):
185+ EverestConfig (** min_config )
186+ finally :
187+ tmp_path .chmod (original_mode )
188+
189+
190+ def test_that_config_directory_parent_without_execute_access_raises_validation_error (
191+ min_config , tmp_path
192+ ):
193+ tmp_path .mkdir (exist_ok = True )
194+ config_path = tmp_path / "sub_dir"
195+ config_path .mkdir (exist_ok = True )
196+ config_file = config_path / "config.yml"
197+ config_file .touch ()
198+ original_mode = tmp_path .stat ().st_mode
199+ tmp_path .chmod (0o444 )
200+ min_config ["config_path" ] = str (config_file )
201+
202+ try :
203+ with pytest .raises (
204+ ValidationError , match = f"No such file or directory { config_file } "
205+ ):
206+ EverestConfig (** min_config )
207+ finally :
208+ tmp_path .chmod (original_mode )
209+
210+
211+ > >> >> >> c5bee30c5e (Bugfix EverestConfig simulation folder validation (#14140))
171212@pytest .mark .parametrize (
172213 ("link" , "source" , "target" ),
173214 [
0 commit comments