def _on_config_changed(changed_name: str) -> None: """Call config_changed hooks if the config changed.""" for mod_info in _module_infos: if mod_info.skip_hooks: continue for option, hook in mod_info.config_changed_hooks: if option is None: hook() else: cfilter = config.change_filter(option) cfilter.validate() if cfilter.check_match(changed_name): hook()
def test_validate(self, option): cf = config.change_filter(option) cf.validate() assert cf in config.change_filters
def test_unknown_option(self, option): cf = config.change_filter(option) with pytest.raises(configexc.NoOptionError): cf.validate()
def test_invalid_change_filter(self, init_patch, args): config.change_filter('foobar') with pytest.raises(configexc.NoOptionError): configinit.early_init(args)
def test_early_init_invalid_change_filter(init_patch, fake_args): config.change_filter('foobar') with pytest.raises(configexc.NoOptionError): config.early_init(fake_args)