@@ -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 ]}},
@@ -135,10 +135,6 @@ def test_extra_key(min_config):
135135 {"forward_model" : ["not_a_job" ]},
136136 "unknown job not_a_job" ,
137137 ),
138- (
139- {"environment" : {"simulation_folder" : "/usr/bin/unwriteable" }},
140- "User does not have write access to" ,
141- ),
142138 (
143139 {"environment" : {"output_folder" : ("super long path" * 300 )}},
144140 "output_folder\n .* File name too long" ,
@@ -168,6 +164,44 @@ def test_invalid_subconfig(extra_config, min_config, expected):
168164 EverestConfig (** min_config )
169165
170166
167+ def test_that_config_directory_without_write_access_raises_validation_error (
168+ min_config , tmp_path
169+ ):
170+ tmp_path .mkdir (exist_ok = True )
171+ config_path = tmp_path / "config.yml"
172+ config_path .touch ()
173+ original_mode = tmp_path .stat ().st_mode
174+ tmp_path .chmod (0o555 )
175+ min_config ["config_path" ] = str (config_path )
176+
177+ try :
178+ with pytest .raises (ValidationError , match = f"'{ tmp_path } ' is not writeable" ):
179+ EverestConfig (** min_config )
180+ finally :
181+ tmp_path .chmod (original_mode )
182+
183+
184+ def test_that_config_directory_parent_without_execute_access_raises_validation_error (
185+ min_config , tmp_path
186+ ):
187+ tmp_path .mkdir (exist_ok = True )
188+ config_path = tmp_path / "sub_dir"
189+ config_path .mkdir (exist_ok = True )
190+ config_file = config_path / "config.yml"
191+ config_file .touch ()
192+ original_mode = tmp_path .stat ().st_mode
193+ tmp_path .chmod (0o444 )
194+ min_config ["config_path" ] = str (config_file )
195+
196+ try :
197+ with pytest .raises (
198+ ValidationError , match = f"No such file or directory { config_file } "
199+ ):
200+ EverestConfig (** min_config )
201+ finally :
202+ tmp_path .chmod (original_mode )
203+
204+
171205@pytest .mark .parametrize (
172206 ("link" , "source" , "target" ),
173207 [
0 commit comments