From e7946fa571a07fa2ff014a735eb4b7b02bf6bb37 Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Fri, 17 Nov 2023 23:49:26 +0100 Subject: [PATCH] conf: ensure that "hidden" features actually exist during validation --- rust2rpm/conf.py | 4 ++++ rust2rpm/tests/test_conf.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/rust2rpm/conf.py b/rust2rpm/conf.py index 0f22493..5363812 100644 --- a/rust2rpm/conf.py +++ b/rust2rpm/conf.py @@ -468,6 +468,10 @@ class TomlConf: for enabled in enable_list: if enabled not in features: 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 features_list := requires_table.get("features"): diff --git a/rust2rpm/tests/test_conf.py b/rust2rpm/tests/test_conf.py index 4248e1d..dbf756f 100644 --- a/rust2rpm/tests/test_conf.py +++ b/rust2rpm/tests/test_conf.py @@ -92,7 +92,7 @@ def test_ini_conf_load( ), ( "chrono-0.4.23.rust2rpm.toml", - set(), + {"__doctest"}, TomlConf( { "features": {