Skip to content

Commit 6c5463b

Browse files
committed
Replace failing test_invalid_subconfig subtest
test_invalid_subconfig began failing due to changes in the environment. Test happened to verify that a validation error is thrown when all directories on the path are unwritable. 1. this is difficult to reproduce in controlled test setup. 2. intuitively one would expect that it is enough for provided directory to be writable, yet check is implemented to verify all directories along the path. Reason for this is unclear. 3. it is unclear if test on purpose used a path with all directories unwritable or if it was an accident. As expected behavior is unknown, create a x-failing replacement test for behavior to be verified in the future.
1 parent 91d37b4 commit 6c5463b

1 file changed

Lines changed: 22 additions & 4 deletions

File tree

tests/everest/test_everlint.py

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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,28 @@ def test_invalid_subconfig(extra_config, min_config, expected):
168164
EverestConfig(**min_config)
169165

170166

167+
@pytest.mark.xfail(
168+
reason=(
169+
"behavior must be looked at. Current code requires all directories on path"
170+
"to be unwritable to raise validation error."
171+
)
172+
)
173+
def test_that_simulation_folder_without_write_access_raises_validation_error(
174+
min_config, tmp_path
175+
):
176+
unwritable = tmp_path / "unwritable"
177+
unwritable.mkdir()
178+
original_mode = unwritable.stat().st_mode
179+
unwritable.chmod(0o555)
180+
181+
try:
182+
min_config["environment"] = {"simulation_folder": str(unwritable)}
183+
with pytest.raises(ValidationError, match="User does not have write access to"):
184+
EverestConfig(**min_config)
185+
finally:
186+
unwritable.chmod(original_mode)
187+
188+
171189
@pytest.mark.parametrize(
172190
("link", "source", "target"),
173191
[

0 commit comments

Comments
 (0)