This commit is contained in:
Jesse Bannon 2023-12-18 15:42:29 -08:00
parent cf92178c82
commit 5e95c83e89
2 changed files with 24 additions and 1 deletions

View file

@ -263,7 +263,7 @@ class MultiUrlValidator(OptionsValidator):
if unresolved := used_variables & unresolved_variables: if unresolved := used_variables & unresolved_variables:
raise self._validation_exception( raise self._validation_exception(
f"variable {variable_name} cannot use the variables " f"variable {variable_name} cannot use the variables "
f"{', '.join(sorted(list(unresolved)))} because they depend on other" f"{', '.join(sorted(list(unresolved)))} because it depends on other"
" variables that are computed later in execution" " variables that are computed later in execution"
) )

View file

@ -333,3 +333,26 @@ class TestPreset:
"overrides": {"the_bad_one": "ack"}, "overrides": {"the_bad_one": "ack"},
}, },
) )
def test_preset_error_added_url_variable_cannot_resolve(self, config_file, output_options):
with pytest.raises(
ValidationException,
match=re.escape(
"variable the_bad_one cannot use the variables subtitles_ext because it "
"depends on other variables that are computed later in execution"
),
):
_ = Preset(
config=config_file,
name="test",
value={
"download": {
"url": "youtube.com/watch?v=123abc",
"variables": {"the_bad_one": "{subtitles_ext}"},
},
"subtitles": {
"embed_subtitles": True,
},
"output_options": {"output_directory": "dir", "file_name": "acjk"},
},
)