conf: ensure that "hidden" features actually exist during validation

This commit is contained in:
Fabio Valentini 2023-11-17 23:49:26 +01:00
parent 1c970e51fd
commit e7946fa571
No known key found for this signature in database
GPG key ID: 5AC5F572E5D410AF
2 changed files with 5 additions and 1 deletions

View file

@ -468,6 +468,10 @@ class TomlConf:
for enabled in enable_list: for enabled in enable_list:
if enabled not in features: if enabled not in features:
raise ConfError(f'Unrecognized "enabled" feature: {enabled!r}') raise ConfError(f'Unrecognized "enabled" feature: {enabled!r}')
if hide_list := features_list.get("hide"):
for hidden in hide_list:
if hidden not in features:
raise ConfError(f'Unrecognized "hidden" feature: {hidden!r}')
if requires_table := toml.get("requires"): if requires_table := toml.get("requires"):
if features_list := requires_table.get("features"): if features_list := requires_table.get("features"):

View file

@ -92,7 +92,7 @@ def test_ini_conf_load(
), ),
( (
"chrono-0.4.23.rust2rpm.toml", "chrono-0.4.23.rust2rpm.toml",
set(), {"__doctest"},
TomlConf( TomlConf(
{ {
"features": { "features": {